[Lazarus] OnMouseWheel[Down/Up] support in TControl (patch included)

Kostas Michalopoulos badsector at slashstone.com
Sat Jun 7 13:11:27 CEST 2008


> In your example the gtk sends the message to Form1 and
> TWinControl.IsControlMouseMsg sends it further to TPaintBox.
>
> Where does the win32 interface send the wheel messages to?

Ok, after this discussion i think i figured out whats wrong: Win32 does 
indeed send the message to TForm (much like GTK does, as you say) *but* the 
coordinates are in screen space, not client space (which explains the 
incorrect translation i mentioned in my original post), so the 
IsControlMouseMsg thinks that the message is for TForm instead of TPaintBox 
because it gets incorrect coordinates (the rest of LCL seems to think that 
wheel messages are always in client space). Bringing them in client space 
when the WM_MOUSEWHEEL event decides that this is a message for us (at the 
end of the message handling in 'case') produces the correct behaviour for 
the test program (and my 3D app) under Windows. Also the received 
coordinates are in the same space with the rest of the mouse events.

I attached a patch against revision 15355 that does exactly that. This patch 
is in the Windows callback function, so the problem is probably now fixed 
where it began from.

Kostas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32-mousewheel-event-coords-fix.patch
Type: application/octet-stream
Size: 579 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20080607/780ce10a/attachment-0007.obj>


More information about the Lazarus mailing list