Discussion:
Mouse wheel event
(too old to reply)
Mike
2008-01-17 14:55:22 UTC
Permalink
Hello, David!



It seems that the mouse wheel event for the custom control is somehow
implemented via the vertical scroll bar events. At least, the custom control
does not receive WM_MOUSEWHEEL message. Is it possible to use a mouse wheel
with the custom control which has no scroll bars at all?



Thank you.

Mik.
David Liebtag
2008-01-17 17:26:24 UTC
Permalink
Mik,

I don't understand your question.

If I )LOAD 2 DEMO145 and remove the HSCROLL and VSCROLL styles from the line
that creates the custom control, the function still receives and processes
mouse wheel events. And, when I trace the events, the seceond element of
the event array is 522 which is the value of WM_MOUSEWHEEL.

I am using CSD 11. What CSD are you using?

I am using a Logitech mouse with the driver supplied with the mouse. What
type of mouse and driver are you using?

David Liebtag
David Liebtag
2008-01-17 19:57:18 UTC
Permalink
Mik,

That makes sense. Input messages always only go to the window that has
focus.

And, the scrollbars reappear because the HANDLE_CUSTOM_EVENTS function sets
the HORIZONTAL LIMITS, VERTICAL LIMITS, HORIZONTAL SELECTION, and VERTICAL
SELECTION properties. If you comment out those lines too, the scroll bars
do not reappear.

David Liebtag
IBM APL Products and Services
Mike
2008-01-18 05:48:26 UTC
Permalink
David,



But the custom control which has no focus does receive all the mouse
messages except for WM_MOUSEWHEEL.

Why?

I believe if custom control has no focus and receives WM_MOUSEMOVE,
WM_LBUTTONDOWN, WM_LBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP etc. messages it
should receive WM_MOUSEWHEEL message as well.

What do you think?



Mik.
Post by David Liebtag
Mik,
That makes sense. Input messages always only go to the window that has
focus.
And, the scrollbars reappear because the HANDLE_CUSTOM_EVENTS function
sets the HORIZONTAL LIMITS, VERTICAL LIMITS, HORIZONTAL SELECTION, and
VERTICAL SELECTION properties. If you comment out those lines too, the
scroll bars do not reappear.
David Liebtag
IBM APL Products and Services
David Liebtag
2008-01-18 23:43:40 UTC
Permalink
Mik,

Microsoft Windows controls what messages are delivered to which windows, not
AP 145.

Windows sends the messages you cite to whatever window under the mouse
pointer responds to the WM_NCHITTEST appropriately. This is NOT necessarily
the window that has focus.

Input messages, like WM_KEYDOWN, WM_KEYUP, WM_HSCROLL, WM_VSCROLL, and
WM_MOUSEHWEEL are sent to the window which has focus. If your custom
control does not have focus, it will not receive any of these messages.

As I said in my offline letter, you should set focus to the custom control
when it receives a WMLBUTTONUP message. This will cause the custom control
to receive subsequent mouse wheel messages.

Now, one might reasonably say that custom controls should automatically give
themselves focus when they receive mouse clicks. I actually thought I had
it coded to do that, but when I tested it with your code, it does not seem
to work. I thought I had coded it so that if you did not create the control
with the NOTABSTOP style, it was presumed to accept input and would set
focus to itself. I will look into it.

In the meantime though, I suggest you simply set focus yourself on mouse
clicks.

David Liebtag

Loading...