LCL: fixed regression in scrolling from r50523 #6bb18f6fbd

git-svn-id: trunk@50557 -
This commit is contained in:
ondrej 2015-12-02 07:49:34 +00:00
parent 0b0f12ffd5
commit 8fae307e89

View File

@ -24,7 +24,7 @@ const
procedure TControlScrollBar.SetPosition(const Value: Integer); procedure TControlScrollBar.SetPosition(const Value: Integer);
var var
MaxPos: Integer; MaxPos, PrevPosition: Integer;
ScrollInfo: TScrollInfo; ScrollInfo: TScrollInfo;
begin begin
if csLoading in FControl.ComponentState then if csLoading in FControl.ComponentState then
@ -70,14 +70,14 @@ begin
if Value = FPosition then if Value = FPosition then
exit; exit;
PrevPosition := FPosition;
// position has to be set before FControl.ScrollBy !!!
FPosition := Value;
// scroll logical client area of FControl // scroll logical client area of FControl
if Kind = sbVertical then if Kind = sbVertical then
FControl.ScrollBy(0, FPosition - Value) FControl.ScrollBy(0, PrevPosition - FPosition)
else else
FControl.ScrollBy(FPosition - Value, 0); FControl.ScrollBy(PrevPosition - FPosition, 0);
// now actually set the position
FPosition := Value;
// check that the new position is also set on the scrollbar // check that the new position is also set on the scrollbar
if HandleAllocated and (GetScrollPos(ControlHandle, IntfBarKind[Kind]) <> FPosition) then if HandleAllocated and (GetScrollPos(ControlHandle, IntfBarKind[Kind]) <> FPosition) then