diff --git a/lcl/forms.pp b/lcl/forms.pp index 984b27eed0..e64251a7ad 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -107,6 +107,7 @@ type FTracking: Boolean; FVisible: Boolean; FOldScrollInfo: TScrollInfo; + FOldVisible: Boolean; FOldScrollInfoValid: Boolean; protected FControl: TWinControl; diff --git a/lcl/include/controlscrollbar.inc b/lcl/include/controlscrollbar.inc index 4de12c29fb..29917ddc36 100644 --- a/lcl/include/controlscrollbar.inc +++ b/lcl/include/controlscrollbar.inc @@ -230,14 +230,18 @@ begin if (not FOldScrollInfoValid) or (not CompareMem(@ScrollInfo, @FOldScrollInfo, SizeOf(TScrollInfo))) then begin FOldScrollInfo := ScrollInfo; - FOldScrollInfoValid := True; SetScrollInfo(ControlHandle, IntfBarKind[Kind], ScrollInfo, NewVisible); // update policy too ScrollInfo.fMask := SIF_UPDATEPOLICY; ScrollInfo.nTrackPos := TrackToPolicyMap[FTracking]; SetScrollInfo(ControlHandle, IntfBarKind[Kind], ScrollInfo, NewVisible); - end; - ShowScrollBar(ControlHandle, IntfBarKind[Kind], NewVisible); + ShowScrollBar(ControlHandle, IntfBarKind[Kind], NewVisible); + end + else + if (not FOldScrollInfoValid) or (FOldVisible <> NewVisible) then + ShowScrollBar(ControlHandle, IntfBarKind[Kind], NewVisible); + FOldVisible := NewVisible; + FOldScrollInfoValid := True; {$IFDEF VerboseScrollingWinControl} //if DebugCondition then DebugLn(['TControlScrollBar.UpdateScrollBar ',DbgSName(FControl),' ',DbgSName(Self),' ',dbgs(Kind),' FVisible=',FVisible,' Range=',FRange,' FPosition=',FPosition,' FPage=',FPage,' FAutoRange=',FAutoRange,' ShouldVisible=',NewVisible,' IsVisible=',IsScrollBarVisible]);