PDA

View Full Version : How to unchecking checkboxes ?


maria-taher
05-06-2010, 10:33 PM
Hello

I create tow checkboxes and a button in a window by a MEL Script.

This is my script :

window -title "Test CheckBox" testswindow;

rowColumnLayout -nc 3;

checkBox
-value 1
-onc "polySphere;"
-label "SPHERE"
-align "left";

checkBox
-value 1
-onc "polyCube;"
-label "CUBE"
-align "left";

button -label "NONE";

showWindow testswindow;


http://ds8.fileflyer.com/d/e134d890-5335-46cd-889f-6aafe9cdea98/zyaK/8HqZJBe/a.png

I want to write a command for unchecking tow checkboxes by clicking on button but I can't write that command.

Please help me.

jschieck
05-06-2010, 10:54 PM
there're many ways to do this. the best is probably to call a procedure that un-checks them when they are clicked. the simplest in this case would to just put it right into your button "-c" command and edit the value of the checkbox to 0

window -title "Test CheckBox" testswindow;
rowColumnLayout -nc 3;

checkBox
-value 1
-onc "polySphere;"
-label "SPHERE"
-align "left"
checkbox1;

checkBox
-value 1
-onc "polyCube;"
-label "CUBE"
-align "left"
checkbox2;

button -label "NONE" -c "checkBox -e -v 0 checkbox1;checkBox -e -v 0 checkbox2;";

showWindow testswindow;

EJ
05-07-2010, 01:35 AM
global proc uncheck(int $state)
{
string $checkboxes[]={"checkbox1", "checkbox2"};

for ($checkbox in $checkboxes)
{
checkBox -e -v $state $checkbox;

}
}


here you can assign the command uncheck to a checkbox or button with an arguement of 0 or 1 for off/on

maria-taher
05-07-2010, 07:15 AM
Thanks jschieck and EJ. Really appreciated.

I can now unchecking checkboxes .

CGTalk Moderation
05-07-2010, 07:15 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.