Hey all, I have fairly deep nesting of controls in my Form. At a
relatively high level in this hierarchy I would like to react to mouse
click, mouse down, mouse up events.
But the events don't seem to perculate up through the containment
hierarchy.
Any suggestions?
Thanks,
Novice
illegal.prime@gmail.com - 11 Jul 2006 00:43 GMT
So it looks like the only way to get this to work is to add a listener
to the contained control's Enter event. Apparently if you add a
Control (an object whose class extends Control) named X to a Panel,
UserControl, etc named Y. And then if you want to listen to mouse
events (movement, click, etc) on X, you need to get a reference to the
X and listen to the appropriate mouse event on X.
Hope that helps someone else out there,
Novice
> Hey all, I have fairly deep nesting of controls in my Form. At a
> relatively high level in this hierarchy I would like to react to mouse
[quoted text clipped - 7 lines]
> Thanks,
> Novice
Stoitcho Goutsev (100) - 11 Jul 2006 14:06 GMT
Hi,
No event does not perculate. Each control has its own surface and the mouse
events are sent to the window (control) under the mouse cursor. Windows
forms doesn't support event bubbling. Upcoming WPF will support event
bubbling and event tunneling which will allow events going up and down in
the controil hierarchy.
For now what you can do is to use message filters. Windows mouse messages
comes through the message queue so they can be handled on the level of the
application.
The following is a thread where I heve posted some sample code:
http://groups.google.ca/group/microsoft.public.dotnet.framework.windowsforms/bro
wse_thread/thread/d3b3044c423df7ec/606da6abeae4716a?lnk=st&q=IMessageFilter+Stoi
tcho&rnum=2&hl=en#606da6abeae4716a

Signature
HTH
Stoitcho Goutsev (100)
> Hey all, I have fairly deep nesting of controls in my Form. At a
> relatively high level in this hierarchy I would like to react to mouse
[quoted text clipped - 7 lines]
> Thanks,
> Novice