Check boxes can be used to turn on and off several options at one time. Consult maya help menu to see full list of options associated with checkboxs.
-checkBox
//This script creates a window holding checkboxs. When you hit the button the
//values of the checkboxs are queried and printed.
if(`window -exists checkBoxWin`)
{
deleteUI checkBoxWin;
windowPref -remove checkBoxWin;
}
string $window = `window -width 150 checkBoxWin`;
columnLayout -adjustableColumn true;
checkBox -label "Default" defaultcheck;
checkBox -label "Left" -align "left" leftcheck;
checkBox -label "Centre" -align "center" centercheck;
checkBox -label "Right" -align "right" rightcheck;
button -label "Check this out" -command "whatIsUp()";
showWindow $window;
proc whatIsUp()
{
string $leftVal = `checkBox -query -value leftcheck`;
string $rightVal = `checkBox -query -value rightcheck`;
string $centerVal = `checkBox -query -value centercheck`;
string $defaultVal = `checkBox -query -value defaultcheck`;
string $myVals[] = {$leftVal,$rightVal,$centerVal,$defaultVal};
string $myButton[] = {"Left Button","Right Button","Center Button","Default Button"};
for ($i = 0; $i < size($myVals); $i++)
{
print ("\n"+$myButton[$i] + " is " + $myVals[$i]);
}
}
|