mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 14:19:17 +02:00
LCL: TScrollingWinControl.ScrollInView or TScrollBox.ScrollInView does not calculate stacked controls, second attempt. Issue #38838.
git-svn-id: trunk@65083 -
This commit is contained in:
parent
5c8e7c1abb
commit
c25e153265
@ -249,18 +249,15 @@ end;
|
|||||||
procedure TScrollingWinControl.ScrollInView(AControl: TControl);
|
procedure TScrollingWinControl.ScrollInView(AControl: TControl);
|
||||||
var
|
var
|
||||||
LRect: TRect;
|
LRect: TRect;
|
||||||
LParent: TWinControl;
|
LPoint: TPoint;
|
||||||
begin
|
begin
|
||||||
if AControl = nil then Exit;
|
if AControl = nil then Exit;
|
||||||
LRect := AControl.BoundsRect;
|
LPoint := AControl.ClientToParent(Point(0, 0), Self);
|
||||||
LParent := AControl.Parent;
|
LRect.Left := LPoint.x;
|
||||||
while LParent <> Self do
|
LRect.Top := LPoint.y;
|
||||||
begin
|
LPoint := AControl.ClientToParent(Point(AControl.Width, AControl.Height), Self);
|
||||||
OffsetRect(LRect, LParent.BoundsRect.Left, LParent.BoundsRect.Top);
|
LRect.Right := LPoint.x;
|
||||||
LParent := LParent.Parent;
|
LRect.Bottom := LPoint.y;
|
||||||
if LParent = nil then Exit; //ScrollingWinControl isn't parent of AControl
|
|
||||||
end;
|
|
||||||
OffsetRect(LRect, -HorzScrollBar.Position, -VertScrollBar.Position);
|
|
||||||
if LRect.Left < 0 then
|
if LRect.Left < 0 then
|
||||||
HorzScrollBar.Position := HorzScrollBar.Position + LRect.Left
|
HorzScrollBar.Position := HorzScrollBar.Position + LRect.Left
|
||||||
else if LRect.Right > ClientWidth then
|
else if LRect.Right > ClientWidth then
|
||||||
|
Loading…
Reference in New Issue
Block a user