Checkbox UI Control

User Interface Controls > Common Properties > Layout > Types > Checkbox

 

   

Creating User Interfaces - Quick Navigation

A checkbox control 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>][tooltip:<string>] [iconName:<filename> iconSize:<point2>]

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.

tooltip: 

A string defining the tooltip to be displayed when the mouse rolls over the checkbox. Available in 3ds Max 2009 and higher.

iconName:

The filename of an icon to use as an image on the button. If iconName is specified, the caption is ignored. The iconSize specifies the iconName size at 100% DPI scaling. If not specified, the default [24,24] is assumed.

iconSize:

The size of the icon specified by iconName at 100% DPI scaling.

   

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.

   

<checkbox>.tooltip String 

Get/set the tooltip of the checkbox. Available in 3ds Max 2009 and higher.

NOTE:

A limitation in the MS Windows implementation of the tooltips causes only the first 80 characters of the tooltip string to be returned to MAXScript.

Tooltips of any length can be SET though.

   

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:The <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.

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

The above 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)

   

on <checkbox> rightClick do <expr> 

Called when the Checkbox control is right-clicked.

Available in 3ds Max 2010 and higher.

   

See Also