GuiControl field to allow mouse passthrough?
by Dusty Monk · in Torque Game Engine · 08/13/2008 (7:17 am) · 4 replies
Does anyone know of an option to set on guiControls to allow mouse events to pass through to their parent?
I know I can create a derived class from the control, and override the OnMouse event functions and pass the events through to the parent.. but I have a number of controls I'd like to do this with, and I would like to not have to create derived classes for all of them.
It seems like pretty common functionality -- I tried the "opaque = false" -- no luck, and "modal = true" -- also did not work.
I know I can create a derived class from the control, and override the OnMouse event functions and pass the events through to the parent.. but I have a number of controls I'd like to do this with, and I would like to not have to create derived classes for all of them.
It seems like pretty common functionality -- I tried the "opaque = false" -- no luck, and "modal = true" -- also did not work.
About the author
Dusty Monk is founder and president of Windstorm Studios, an independant game studio. Formerly a sr. programmer at Ensemble Studios, Dusty has worked on AAA titles such as Age of Empires II & III, and Halo Wars.
#2
ParentControl
ButtonControl
MouseCaptureControl
If you place the mousecapture control over the button, any event captured will go to the parent.
If you want to allow mouse events on the button you just make this MouseCapture control invisible so that it wont process any mouse events.
Luck!
Guimo
08/31/2008 (9:38 pm)
There is a mouse passthrough control in afx... but anyway you only would need to make one transparent control which captures the mouse event and passes it to the parent. Then lay this control over the control you want to skip. Like:ParentControl
ButtonControl
MouseCaptureControl
If you place the mousecapture control over the button, any event captured will go to the parent.
If you want to allow mouse events on the button you just make this MouseCapture control invisible so that it wont process any mouse events.
Luck!
Guimo
#3
Seems like the best way would be to start at the bottom, in "guiControl". Add a member var. like "ignoreInput" which is set to "false" by default, and only set to "true" when needed. Yeah, it would take some coding to hook it all up, but the final result would be more elegant, IMO.
09/11/2008 (4:24 pm)
A MouseCaptureControl seems pretty heavy-handed and problematic; I know I wouldn't want to deal with a bunch of these. (O.o)Seems like the best way would be to start at the bottom, in "guiControl". Add a member var. like "ignoreInput" which is set to "false" by default, and only set to "true" when needed. Yeah, it would take some coding to hook it all up, but the final result would be more elegant, IMO.
#4
09/12/2008 (8:52 am)
That is exactly what I did in all of my projects. I added mIgnore to guiControl and had it default to false.
Associate James Ford
Sickhead Games