Toggle#

class UI.Toggle()#

A control that is either checked or not. Added to a UI.Canvas or a UI.Panel.

Note

On its own a toggle is a check box. Put several of them in the same UI.ToggleGroup and they become radio buttons, as only one toggle in a group can be checked at a time.

Base class: UI.InputControl
Toggle.getText()#

The text for the toggle.

Property:

Read-only, cannot be set

Return type:

UI.Text

Toggle.getChecked()#
Toggle.setChecked(value)#

Whether the toggle is checked.

Property:

Can be read or written

Return type:

boolean

Note

Checking a toggle that belongs to a UI.ToggleGroup unchecks the rest of that group, whether or not it is on the screen.

Toggle.getGroup()#
Toggle.setGroup(value)#

The group that the toggle belongs to, or null if it does not belong to one.

Property:

Can be read or written

Return type:

UI.ToggleGroup or null

Note

Only one toggle in a group can be checked at a time, so a group turns a set of toggles into radio buttons. A group does not have to contain the toggles, so they can be grouped independently of how they are laid out.