Torque3D Documentation / _generateds / GuiCheckBoxCtrl

GuiCheckBoxCtrl

consoledoc.h

A named checkbox that can be toggled on and off.

More...

Public Functions

bool

Test whether the checkbox is currently checked.

void
setStateOn(bool newState)

Set whether the checkbox is ticked or not.

Detailed Description

A named checkbox that can be toggled on and off.

A GuiCheckBoxCtrl displays a text label next to a checkbox that can be toggled on and off by the user. Checkboxes are usually used to present boolean choices like, for example, a switch to toggle fullscreen video on and off.

// Create a checkbox that allows to toggle fullscreen on and off.
new GuiCheckBoxCtrl( FullscreenToggle )
{
   text = "Fullscreen";
};

// Set the initial state to match the current fullscreen setting.
FullscreenToggle.setStateOn( Canvas.isFullscreen() );

// Define function to be called when checkbox state is toggled.
function FullscreenToggle::onClick( %this )
{
   Canvas.toggleFullscreen();
}

Public Functions

isStateOn()

Test whether the checkbox is currently checked.

return:

True if the checkbox is currently ticked, false otherwise.

setStateOn(bool newState)

Set whether the checkbox is ticked or not.

Parameters:

newState

If true the box will be checked, if false, it will be unchecked.

note:

This method will not trigger the command associated with the control. To toggle the checkbox state as if the user had clicked the control, use performClick().