LCL: added capfHasScrollOffset in Controls.FindControlAtPosition(), also fixed TGraphicControl.Update, it should take into account parent's scrolloffset if any. issues #12217,#18272

git-svn-id: trunk@31577 -
This commit is contained in:
zeljko 2011-07-06 20:52:09 +00:00
parent 97085f283e
commit 5c16268dbe
2 changed files with 7 additions and 2 deletions

View File

@ -2812,7 +2812,8 @@ begin
begin
Result := WinControl;
Control := WinControl.ControlAtPos(WinControl.ScreenToClient(Position),
[capfAllowDisabled, capfAllowWinControls, capfRecursive]);
[capfAllowDisabled, capfAllowWinControls, capfRecursive,
capfHasScrollOffset]);
//debugln(['FindControlAtPosition ',dbgs(Position),' ',DbgSName(WinControl),' ',dbgs(WinControl.ScreenToClient(Position)),' ',DbgSName(Control)]);
if Control <> nil then
Result := Control;

View File

@ -114,11 +114,15 @@ end;
procedure TGraphicControl.Update;
var
R: TRect;
Pt: TPoint;
begin
if Assigned(Parent) and Parent.HandleAllocated and Parent.Visible then
begin
R := ClientRect;
OffsetRect(R, Left, Top);
Pt := Parent.GetClientScrollOffset;
OffsetRect(R, Left - Pt.X, Top - Pt.Y);
R.Right := R.Right + Pt.X;
R.Bottom := R.Bottom + Pt.Y;
LCLIntf.InvalidateRect(Parent.Handle, @R, True);
end;
end;