diff --git a/lcl/include/controlscrollbar.inc b/lcl/include/controlscrollbar.inc index 68ca9b5f06..541438851f 100644 --- a/lcl/include/controlscrollbar.inc +++ b/lcl/include/controlscrollbar.inc @@ -247,9 +247,9 @@ begin With TScrollingWinControl(FControl) do begin // page if Self.Kind=sbVertical then - FPage := TScrollBarInc(Min(ClientHeight + 1,High(FPage))) + FPage := TScrollBarInc(Min(ClientHeight - 1,High(FPage))) else - FPage := TScrollBarInc(Min(ClientWidth + 1,High(FPage))); + FPage := TScrollBarInc(Min(ClientWidth - 1,High(FPage))); ScrollInfo.nPage := FPage; // range diff --git a/lcl/include/scrollingwincontrol.inc b/lcl/include/scrollingwincontrol.inc index e7f1c2901f..db525463e3 100644 --- a/lcl/include/scrollingwincontrol.inc +++ b/lcl/include/scrollingwincontrol.inc @@ -120,21 +120,8 @@ begin end; procedure TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer); -var - Control: TControl; - I: integer; begin TWSScrollingWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY); - for I := 0 to ControlCount - 1 do - begin - Control := Controls[I]; - if not (Control is TWinControl) or not TWinControl(Control).HandleAllocated then - begin - // widgetset does not know about this control - Control.SetBounds(Control.Left+DeltaX, Control.Top+DeltaY, - Control.Width, Control.Height); - end; - end; Invalidate; end; diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index 20a0c659ba..f3805f7d08 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -94,7 +94,7 @@ var implementation uses - SysUtils, LCLStrConsts, Menus, Dialogs, StdCtrls, ExtCtrls, + SysUtils, LCLStrConsts, Menus, Dialogs, StdCtrls, ExtCtrls, Forms, LCLIntf; //remove this unit when GetWindowSize is moved to TWSWinControl {$IFOPT C-} @@ -772,8 +772,14 @@ Begin TheWinControl:=TWinControl(Sender); if not TheWinControl.HandleAllocated then exit; Handle := TheWinControl.Handle; - ORect.Left := 0; - ORect.Top := 0; + if TheWinControl is TScrollingWinControl then + begin + ORect.Left := -TScrollingWinControl(TheWinControl).HorzScrollBar.Position; + ORect.Top := -TScrollingWinControl(TheWinControl).VertScrollBar.Position; + end else begin + ORect.Left := 0; + ORect.Top := 0; + end; ORect.Bottom := 0; ORect.Right := 0; If (TheWinControl is TCustomGroupBox) Then