Sign in Join

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

Mailing lists / lazarus / 2017-10

Mousewheel events on TCustomControl

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Martok

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 also want the solution to be stable across other
widgetsets...

Martok

Reply by email

Vojtěch Čihák

Hi,
 
your scrollbars are part of control? I mean, are they created via   ShowScrollBar(Handle, SB_HORZ, True);
  ShowScrollBar(Handle, SB_VERT, True);  ?
 
You wrote component ECScheme, it is part of ECControls and I didn't use DoMouseWheelxxx use   procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL;   procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;   instead to update area and it works well.
 
V.
______________________________________________________________

Show quoted text 5 lines
Od: Martok via Lazarus Komu: Datum: 03.10.2017 18:32 Předmět: [Lazarus] Mousewheel events on TCustomControl

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 also want the solution to be stable across other
widgetsets...

Martok --

Reply by email

Martok
to Vojtěch Čihák:   your scrollbars are part of control? I mean, are they created via  …

Hi,

your scrollbars are part of control? I mean, are they created via   ShowScrollBar(Handle, SB_HORZ, True);   ShowScrollBar(Handle, SB_VERT, True);  ?

No, they are created as TScrollBar controls parented to the control and placed in the client area. There should be nothing giving the widgetset the impression that this scrollbar is somehow scrolling the window...

[I] wrote component ECScheme, it is part of ECControls and I didn't use DoMouseWheelxxx use   procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL;   procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;  

The messages are not received at all, no matter the handler. But thanks for the reminder, if it works I'll need these either way for horizontal scrolling :)

Martok

Reply by email