[Lazarus] Mousewheel events on TCustomControl

Martok listbox at martoks-place.de
Tue Oct 3 18:32:02 CEST 2017

Hi all,

I'm having some strange trouble with mouse interaction with a
TCustomControl-derived component. I have only been able to test with the win32
widgetset, and it works on some machines and doesn't work on others.

The component draws its content to its TCanvas, and additionally places some
controls in its client space. Specifically, TScrollBars which the user can use
to scroll segments of the content.

I want to add mouse wheel scrolling in the client area, so I overwrite
DoMouseWheel and put my handling there. This works well on some systems, but for
others (including my main development system), the MouseWheel message is not
delivered to the CustomControl, but instead to what appears to be the first
TScrollbar (not necessarily the focused control). The component never receives it.

Do you have an idea what could be happening here, and how I could fix that?
MouseCapture might be an idea, but all examples I've seen don't seem very
reliable at un-capturing. I also want the solution to be stable across other

More information about the Lazarus mailing list