Gui
by Brian Robbins · in Technical Issues · 05/13/2008 (9:21 am) · 4 replies
I'm attempting to create a window that pops up when the mouse enters the GUI bounds, but I want it to remain hidden until then. I'm not sure where to start, weather or not to create a separate file to contain the code, and where to put that file/code. I'm trying to do something we never covered in class, and I can't seem to piece it together. *begs for help*
#2
Just found this. Ed Maurina has some really good tips on using GuiMouseEventCtrl's to catch the events you need. Very simple way to get what you need. Hope that helps!
05/13/2008 (12:29 pm)
www.garagegames.com/mg/forums/result.thread.php?qt=53463Just found this. Ed Maurina has some really good tips on using GuiMouseEventCtrl's to catch the events you need. Very simple way to get what you need. Hope that helps!
#3
05/15/2008 (8:15 am)
I can't access the link :( This is for a school project and I only have access at the campus. *sigh* Also, working in 2D.
#4
That should do what you want it to do.
05/15/2008 (1:49 pm)
Actually, that is for TGB. It's the private forum though, so if you don't have a license, you can't get to it. I'll quote Ed Maurina from the thread, since that post only covers scripting:Quote:Hi. You can also use the GuiMouseEventCtrl. Overlap the 'hot region' where you want to catch inputs with this control and define the proper callbacks.
Basic Steps:
1. Name your GuiMouseEventCtrl control. For example: myMouseCatcher
2. Write a callback for each of the events you want to catch:
function myMouseCatcher::onMouseDown( %theControl, %modifiers, %point, %clicks ){ // Do something with the inputs.}
Some Possible Events:
onMouseDown - Left Mouse Button Press
onMouseUp - Left Mouse Button Release
onRightMouseDown - Right Mouse Button Press
onRightMouseUp - Right Mouse Button Release
onMouseEnter - self explanatory
onMouseLeave - self explanatory
onMouseMove - self explanatory
onMouseDrag - Moving with left mouse button down.
3. You should be good to go.
I talk about this in my book The Game Programmers Guide To Torque on pages 525 .. 528. Note: Although this book was written for TGE,much of it also applies to TGB.
That should do what you want it to do.
Torque 3D Owner Ted Southard
You might want to do a toggle function, like you would see in the default.bind.cs files, where the key binding functions for toggling GUI's and actions are kept. So, when the mouse hovers, call your toggle function, and push and pop your dialog as needed.