Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-09

TWinControl.GetClientOrigin

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Micha Nelissen

Hi,

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.

Regards,

Micha.

Reply by email

Micha Nelissen
to Micha Nelissen
Show quoted text 15 lines
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)?

Regards,

Micha.

Reply by email