[lazarus] TWinControl.GetClientOrigin

Micha Nelissen M.Nelissen at student.tue.nl
Tue Sep 30 07:32:55 EDT 2003

> TWinControl.GetClientOrigin is used by TControl.ScreenToClient which is 
> used by FindDragTarget. FindDragTarget retrieves the mouse position and 
> subtracts the client origin from it to find client position. Therefore 
> it needs current on-screen position of control, not the LCL position. 
> The LCL position is different when the LCL wants something to be in a 
> different place but it can't be, for example a TCustomGroupBox page 
> always has an offset of (0,22) or so in win32.
> The result of this bug is that FindDragTarget does not work properly and 
> so controls get MOUSELEAVE,MOUSEENTER incorrectly which is very 
> confusing. IMHO this should be a high priority bug, albeit a complex one.
> Furtermore, notice that this only happens when a control is resized, 
> initially it does work properly. So it could be a problem in the win32 
> interface too, not handling resize correctly (still) or so.

Okay after some more debugging I notice that the first time the Left,Top 
of the groupbox page is (4,22), so there is no difference between 
BoundsRealized and (Left,Top), both (4,22). But when the form is 
resized, the LCL wants to set left,top to (0,0) and then trouble begins. 
So we have to determine: where is the bug? Should be (0,0) immediately 
or should the resize leave it at (4,22)?



More information about the Lazarus mailing list