From cba1730e769dc49453ac649ae4f8a79ae62c959f Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 20 Apr 2010 17:08:50 +0000 Subject: [PATCH] Qt: fixed problem with setScrollInfo(), use ScrollBar.BeginUpdate() & ScrollBar.EndUpdate() only when other params aren't setted up (range,pagestep).Completely fixes #16255 git-svn-id: trunk@24746 - --- lcl/interfaces/qt/qtwinapi.inc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index 7a013bc8e7..34d5ec7087 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -5035,11 +5035,14 @@ var function UpdateScrollInfo: Integer; var iReCountMax: Integer; + SBUpdatesCount: Integer; begin Result := 0; + SBUpdatesCount := 0; if (ScrollInfo.FMask and SIF_RANGE) <> 0 then begin + inc(SBUpdatesCount); ScrollBar.setMinimum(ScrollInfo.nMin); // we must recount ScrollBar.Max since invalid value raises AV @@ -5055,6 +5058,7 @@ var // segfaults if we don't check Enabled property if ScrollBar.getEnabled then begin + inc(SBUpdatesCount); ScrollBar.setPageStep(ScrollInfo.nPage); ScrollBar.setSingleStep((ScrollBar.getPageStep div 6) + 1); end; @@ -5062,18 +5066,22 @@ var if (ScrollInfo.FMask and SIF_POS) <> 0 then begin - ScrollBar.BeginUpdate; - try - if (ScrollInfo.nPos < ScrollBar.getMin) then - ScrollInfo.nPos := ScrollBar.getMin - else - if (ScrollInfo.nPos > ScrollBar.getMax) then - ScrollInfo.nPos := ScrollBar.getMax; + inc(SBUpdatesCount); + if (ScrollInfo.nPos < ScrollBar.getMin) then + ScrollInfo.nPos := ScrollBar.getMin + else + if (ScrollInfo.nPos > ScrollBar.getMax) then + ScrollInfo.nPos := ScrollBar.getMax; + + if SBUpdatesCount = 1 then + ScrollBar.BeginUpdate; + try if (ScrollInfo.FMask and SIF_UPDATEPOLICY) = 0 then ScrollBar.setValue(ScrollInfo.nPos); finally - ScrollBar.EndUpdate; + if SBUpdatesCount = 1 then + ScrollBar.EndUpdate; end; end;