Another GUI issue: GuiButtonCtrl Highlights When Inactive
by Ryan Strandberg · in Torque 2D Beginner · 10/29/2014 (7:28 pm) · 5 replies
Just wondering if anyone knows how to turn mouseover highlighting off when a GuiButtonCrtl is set to inactive?
I'm working around it by having another profile with an image that has the "inactive image" for all 4 options and switch to it, but I'd hate to have to do this with every button I want like this.
I'm working around it by having another profile with an image that has the "inactive image" for all 4 options and switch to it, but I'd hate to have to do this with every button I want like this.
About the author
#2
10/29/2014 (10:53 pm)
Well that sucks, might have to look a little harder into guiImageButtonCtrl then. Looks like they do pretty much the same thing, correct?
#3
10/30/2014 (5:40 am)
Yeah, they're the same control except that the ImageButton uses ImageAssets for its states instead of "loose" png files.
#4
S32 indexMultiplier = 1;
if ( mDepressed || mStateOn ) indexMultiplier = 3;
else if ( mMouseOver ) indexMultiplier = 2;
else if ( !mActive ) indexMultiplier = 4;
This is the original code. I just removed the else from the last option and everything worked perfect. I'm sure someone better then me at this could make it an option to highlight when moused over and inactive, but I don't know anything about c++.
11/03/2014 (4:58 am)
Well I found the issue in the source code, but I don't really know how to go about suggesting a fix. It's in the onRender() of the guiButtonCtrl. When rendering it used an if else statement to select which image to use.S32 indexMultiplier = 1;
if ( mDepressed || mStateOn ) indexMultiplier = 3;
else if ( mMouseOver ) indexMultiplier = 2;
else if ( !mActive ) indexMultiplier = 4;
This is the original code. I just removed the else from the last option and everything worked perfect. I'm sure someone better then me at this could make it an option to highlight when moused over and inactive, but I don't know anything about c++.
#5
S32 indexMultiplier = 1;
if ( mDepressed || mStateOn ) indexMultiplier = 3;
// if not active, set index 4
else if ( !mActive ) indexMultiplier = 4;
// active and mouse over, set index 2
else if ( mMouseOver ) indexMultiplier = 2;
11/03/2014 (7:54 pm)
This should fix it.S32 indexMultiplier = 1;
if ( mDepressed || mStateOn ) indexMultiplier = 3;
// if not active, set index 4
else if ( !mActive ) indexMultiplier = 4;
// active and mouse over, set index 2
else if ( mMouseOver ) indexMultiplier = 2;
Torque Owner Richard Ranft
Roostertail Games