Torque 3D - Script Manual: GuiCheckBoxCtrl Class Reference

TorqueScript

Main   Class List   Namespace List   Online

GuiCheckBoxCtrl Class Reference
[Button Controls]

A named checkbox that can be toggled on and off. More...

Inheritance diagram for GuiCheckBoxCtrl:

List of all members.

Public Member Functions

bool isStateOn ()
 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.

Example:
// 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();
}

Member Function Documentation

bool GuiCheckBoxCtrl::isStateOn (  ) 

Test whether the checkbox is currently checked.

Returns:
True if the checkbox is currently ticked, false otherwise.
void GuiCheckBoxCtrl::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().

Reimplemented from GuiButtonBaseCtrl.



Copyright © GarageGames, LLC. All Rights Reserved.