A checkbox item is used to place a check box on the rollout. The user can click to successively switch between states. The syntax is:
checkbox <name> [ <caption> ] [ checked:<boolean> ] [triState:<integer>]
The default alignment of checkbox items is #left.
Parameters
checked:
Initial state of the check box, defaults to false (unchecked).
triState:
An integer value controlling the checked state of the checkbox as follows:
0 – unchecked (checked:false)
1 – checked (checked:true)
2 – indeterminate (checked:true)
When set to 2 (indeterminate), the checkbox will be displayed as greyed out and checked at the same time. Note that triState: has a higher priority than checked: which means that if you set the parameter checked: to false and the parameter triState: to 2, the .checked property will return true. The checked: parameter / property remains <boolean> for backwards compatibility.
Clicking an indeterminate checkbox changes its state to unchecked.
Properties
<checkbox>.checked Boolean
The state of the check box, on (true) or off (false).
<checkbox>.state Boolean
Synonym for .checked
<checkbox>.triState Integer
Get/Set the state of the checkbox to checked, unchecked or indeterminate. See the triState: parameter for details.
Events
on <checkbox> changed <arg> do <expr>
Called when the user clicks the check box to check or uncheck it. The <arg> argument contains the new state of the check box, on (true) or off (false).
Note
that <arg> is a local variable in the context of the event handler – you can use it inside the handler to act according to the new state of the checkbox.
For example
utility testCheckBox "Test The CheckBox"
(
checkbox myCheckBox "Click Me"
-- theState is a user variable name that will contain the state
-- of the checkbox whenever the change handler is executed
on myCheckBox changed theState do
messagebox ("Checkbox state is " + theState as string)
)--end utility
Note that this is equivalent to using
on myCheckBox changed theState do
messagebox ("Checkbox state is " + myCheckBox.state as string)
or
on myCheckBox changed theState do
messagebox ("Checkbox state is " + myCheckBox.checked as string)
See also
Rollout User-Interface Items Common Properties
Rollout User-Interface Items Common Layout Parameters
Rollout User-Interface Control Types