From 8fae307e89e0203c80b15232bb0a36bda9cab868 Mon Sep 17 00:00:00 2001 From: ondrej Date: Wed, 2 Dec 2015 07:49:34 +0000 Subject: [PATCH] LCL: fixed regression in scrolling from r50523 #6bb18f6fbd git-svn-id: trunk@50557 - --- lcl/include/controlscrollbar.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lcl/include/controlscrollbar.inc b/lcl/include/controlscrollbar.inc index f2d3869f49..fe83b5a2b6 100644 --- a/lcl/include/controlscrollbar.inc +++ b/lcl/include/controlscrollbar.inc @@ -24,7 +24,7 @@ const procedure TControlScrollBar.SetPosition(const Value: Integer); var - MaxPos: Integer; + MaxPos, PrevPosition: Integer; ScrollInfo: TScrollInfo; begin if csLoading in FControl.ComponentState then @@ -70,14 +70,14 @@ begin if Value = FPosition then exit; + PrevPosition := FPosition; + // position has to be set before FControl.ScrollBy !!! + FPosition := Value; // scroll logical client area of FControl if Kind = sbVertical then - FControl.ScrollBy(0, FPosition - Value) + FControl.ScrollBy(0, PrevPosition - FPosition) else - FControl.ScrollBy(FPosition - Value, 0); - - // now actually set the position - FPosition := Value; + FControl.ScrollBy(PrevPosition - FPosition, 0); // check that the new position is also set on the scrollbar if HandleAllocated and (GetScrollPos(ControlHandle, IntfBarKind[Kind]) <> FPosition) then