Mouse-Over Events on buttons
by JohnT · in Torque Game Engine · 01/22/2006 (7:18 am) · 4 replies
Hello,
Does anyone know of a way to intercept a mouse-over from a button in a gui? I am trying to implement a dialog that changes an image on the dialog as the mouse is moved over various buttons.
Thanks!
Does anyone know of a way to intercept a mouse-over from a button in a gui? I am trying to implement a dialog that changes an image on the dialog as the mouse is moved over various buttons.
Thanks!
About the author
#2
From the initial question, it sounds as if he doesn't want the button itself to change, but the parent GuiControl, so you'll need to do some manual handling there as the second poster indicates.
02/10/2006 (12:35 pm)
Keep in mind that if you simply want the image of a button itself to change as the mouse interacts with that button, make your button a GuiBitmapButtonCtrl. Note that this is now stock Torque--some references in search indicate a resource has to be added (no longer the case).From the initial question, it sounds as if he doesn't want the button itself to change, but the parent GuiControl, so you'll need to do some manual handling there as the second poster indicates.
#3
02/10/2006 (12:45 pm)
@Jeff, this was the next item on my list. I was just getting ready to hunt down this info. Thanks
#4
Thanks Guys!
02/10/2006 (12:50 pm)
Actually I have the mouse over working on the button. My problem was with intercepting the mouse over event so that I can change an image in the background to show snapshots of various missions. I'll give this a try.Thanks Guys!
Torque Owner Jeff White
void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event) { ... Con::executef(this, 1, "onMouseEnter"); }Then in GUI script, handle the mouse enter for each button
function button1::onMouseEnter(%this) { // change image }The same can be done for 'onMouseLeave' to clear the image
-Jeff