The ones they use in the GUI editor are _radioButton.
When I created my own buttons, I used a mix of the radio button and the normal button. This way it has only a texture, and not all the sides which come with the dynamic buttons. It is basically a button.
In the DOM, create new My_button
archtype is guicontrol
add parent _Guibutton
In the GUI editor create new
name My_button
inherit from _radioButton
class My_button
In properties set size and texture.
When you add the button to a gui, set the name, and location.
method _OnButtonMouseClick(button as NodeRef of Class _GUIButton, args references Class GUIMouseEvent)
myChoice as string = "choice1"
selectedColor as Class rgba = setSelectedColor(myChoice)
type as NodeRef of Class GUIControl
when button.name
is "myButtonName1"
clearAllButtons()
type.defaultStatePresentation.color = setSelectedColor // set this button as highlighted - radio selection
// do stuff for this button
.
is "myButtonName2"
clearAllButtons()
type.defaultStatePresentation.color = setSelectedColor // set this button as highlighted - radio selection
// do stuff for this button
.
.
.
// set buttons to same color
function clearAllButtons()
Loc as NodeRef of Class GUIControl = FindGUIControlByName(None, "myButtonPanel")
myChoice as string = "choice1"
setColor as Class rgba = setMainColor(myChoice)
type as NodeRef of Class GUIControl
type = findGUIControlByName(Loc, "myButtonName1")
type.defaultStatePresentation.color = setColor
type = findGUIControlByName(Loc, "myButtonName2")
type.defaultStatePresentation.color = setColor
.
// set main color for button
function setMainColor(myChoice as string) as Class rgba
setColor as Class rgba
when myChoice
is "choice1"
setColor = MiscUtils:MakeRGBA( 0, 0, 0.8, 1 ) // dk blue
.
is "choice2"
setColor = MiscUtils:MakeRGBA( 0.8, 0, 0, 1 ) // dk red
.
return setColor
.
// set selected color for button
function setSelectedColor(myChoice as string) as Class rgba
setColor as Class rgba
when myChoice
is "choice1"
setColor = MiscUtils:MakeRGBA( 0, 0, 1, 1 ) // blue
.
is "choice2"
setColor = MiscUtils:MakeRGBA( 1, 0, 0, 1 ) // red
.
return setColor
.