Game Development Community

T3D 1.1 Final - Feature Request: Toggle Button Has No GetState - NOT A BUG

by Steve Acaster · in Torque 3D Professional · 07/06/2011 (1:56 pm) · 3 replies

T3D 1.1

win7 32 bit

Target
GUI toggle button

Issue:
ToggleButton has a *.setStateOn(bool) function (for pressed/unpressed) but rather oddly has no *.getState(float) function in script to identify which state is currently set.

Suggest:
Create a *.getState(float) function to return the toggleButton's state.

[edit]
And I've just been informed through the mystical powers of irc that *.getStateOn() function does actually exist in the engine, it's just not exposed to script.

#1
07/06/2011 (3:00 pm)
.getValue() will give you that. 1 for pressed, 0 for unpressed. .setValue can set the state but doesn't set the state of other buttons in the group. .setStateOn handles that- setting the value of that button and the other buttons in the group.
#2
07/06/2011 (3:05 pm)
Quote:
.getValue() will give you that.
So it does!
#3
07/06/2011 (3:55 pm)
Thanks to Tron there is also this engineMethod now:
DefineEngineMethod( GuiButtonBaseCtrl, getStateOn, bool, (),,
   "For toggle or radio buttons, get whether the button is currently activated or not.\n"
   "@return true if the button is in an On or active state, else false for an Off or inactive state.\n")
{
   return object->getStateOn();
}

I'll leave it up to GG to decide whether they want to include this - or just give the *.getValue() function a little more explanation in comments regarding it's use with toggleButton.