2010

Table Of Contents
The offCommand flag triggers when the check box is unchecked.
You can use the checkBox command with an edit flag to change the state of
a check box in the user interface.
To change the values of elements in the user interface
1 In the tempMEL tab, change the state of the make roll windows check
box by executing the following:
checkBox -edit -value 0 $box_sim_checkbox;
The Box Simulation check box, which was turned on, is now turned off.
You can repeat this command with a value of 1 to turn the check box
back on.
This shows the use of the edit flag with a command as an argument to
a command flag, which allows you to change values.
Well now use the onCommand and offCommand flags to keep the two check
boxes in sync, so that when one check box has its state changed, the
other check box is set to the opposite state.
2 Replace the existing check box commands ($box_sim_checkbox and
$sphere_sim_checkbox) in the MEL2 tab. This will be approximately lines
38-46 depending on whether you added lines at the beginning of the file.
Replace these two commands with the following:
$box_sim_checkbox = `checkBox -value 1 -label "Box Simulation"
-onCommand "checkBox -edit -value 0 $sphere_sim_checkbox;" -
offCommand "checkBox -edit -value 1 $sphere_sim_checkbox;"`;
$sphere_sim_checkbox = `checkBox -value 0 -label "Sphere Simu
lation" -onCommand "checkBox -edit -value 0 $box_sim_checkbox;"
-offCommand "checkBox -edit -value 1 $box_sim_checkbox;"`;
The commands you are replacing are located on lines 35-43 of the original
script file.
698 | Chapter 13 Scripting in Maya