Torque3D Documentation / _generateds / GuiButtonBaseCtrl

GuiButtonBaseCtrl

consoledoc.h

The base class for the various button controls.

More...

Button

caseString

Text label to display on button (if button class supports text labels).

string

ID of string in string table to use for text label on button.

int

Radio button toggle group number. All radio buttons that are assigned the same groupNum and that are parented to the same control will synchronize their toggle state, i.e. if one radio button is toggled on all other radio buttons in its group will be toggled off.

Button behavior type.

bool

If true, mouse events will be passed on to script. Default is false.

Callbacks

void

If useMouseEvents is true, this is called when the left mouse button is pressed on an (active) button.

void

If useMouseEvents is true, this is called when the left mouse button is release over an (active) button.

void

Called when the primary action of the button is triggered (e.g. by a left mouse click).

void

Called when the left mouse button is double-clicked on the button.

void

Called when the right mouse button is clicked on the button.

void

If useMouseEvents is true, this is called when the mouse cursor moves over the button (only if the button is the front-most visible control, though).

void

If useMouseEvents is true, this is called when the mouse cursor moves off the button (only if the button had previously received an onMouseEvent() event).

void

If useMouseEvents is true, this is called when a left mouse button drag is detected, i.e. when the user pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with the mouse button still pressed.

Public Functions

string

Get the text display on the button's label (if any).

void

Simulate a click on the button.

void

Reset the mousing state of the button.

void
setStateOn(bool isOn)

For toggle or radio buttons, set whether the button is currently activated or not. For radio buttons, toggling a button on will toggle all other radio buttons in its group to off.

void
setText(string text)

Set the text displayed on the button's label.

void
setTextID(string id)

Set the text displayed on the button's label using a string from the string table assigned to the control.

Detailed Description

The base class for the various button controls.

This is the base class for the various types of button controls. If no more specific functionality is required than offered by this class, then it can be instantiated and used directly. Otherwise, its subclasses should be used:

Button

caseString text 

Text label to display on button (if button class supports text labels).

string textID 

ID of string in string table to use for text label on button.

int groupNum 

Radio button toggle group number. All radio buttons that are assigned the same groupNum and that are parented to the same control will synchronize their toggle state, i.e. if one radio button is toggled on all other radio buttons in its group will be toggled off.

The default group is -1.

GuiButtonType buttonType 

Button behavior type.

bool useMouseEvents 

If true, mouse events will be passed on to script. Default is false.

Callbacks

onMouseDown()

If useMouseEvents is true, this is called when the left mouse button is pressed on an (active) button.

onMouseUp()

If useMouseEvents is true, this is called when the left mouse button is release over an (active) button.

note:

To trigger actions, better use onClick() since onMouseUp() will also be called when the mouse was not originally pressed on the button.

onClick()

Called when the primary action of the button is triggered (e.g. by a left mouse click).

onDoubleClick()

Called when the left mouse button is double-clicked on the button.

onRightClick()

Called when the right mouse button is clicked on the button.

onMouseEnter()

If useMouseEvents is true, this is called when the mouse cursor moves over the button (only if the button is the front-most visible control, though).

onMouseLeave()

If useMouseEvents is true, this is called when the mouse cursor moves off the button (only if the button had previously received an onMouseEvent() event).

onMouseDragged()

If useMouseEvents is true, this is called when a left mouse button drag is detected, i.e. when the user pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with the mouse button still pressed.

Public Functions

getText()

Get the text display on the button's label (if any).

return:

The button's label.

performClick()

Simulate a click on the button.

This method will trigger the button's action just as if the button had been pressed by the user.

resetState()

Reset the mousing state of the button.

This method should not generally be called.

setStateOn(bool isOn)

For toggle or radio buttons, set whether the button is currently activated or not. For radio buttons, toggling a button on will toggle all other radio buttons in its group to off.

Parameters:

isOn

If true, the button will be toggled on (if not already); if false, it will be toggled off.

note:

Toggling the state of a button with this method will not not trigger the action associated with the button. To do that, use performClick().

setText(string text)

Set the text displayed on the button's label.

Parameters:

text

The text to display as the button's text label.

note:

Not all buttons render text labels.

setTextID(string id)

Set the text displayed on the button's label using a string from the string table assigned to the control.

Parameters:

id

Name of the variable that contains the integer string ID. Used to look up string in table.

note:

Not all buttons render text labels.

Gui_i18n