PDA

View Full Version : updating self window with check box question


zin64
01-11-2013, 03:51 PM
Hi all,
I have a created a UI with three check boxes and three rows of buttons. I am hoping to uncheck one of the check box to have one row of the buttons to disappear . Uncheck all three check box will make all rows of button to disappear. Of course if the check box is checked the corresponding row of buttons will appear again.

Here's my MEL script:
//////////////////////////////////////////////////////////////
if(`window -exists chooserWin`)
{
deleteUI chooserWin;
}

window -t "Chooser" -widthHeight 340 400 chooserWin;

columnLayout -columnAttach "both" 5 -columnWidth 340;
rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60;
checkBox -v 1 -l "SetA" setAChecker;
checkBox -v 1 -l "SetB" setBChecker;
checkBox -v 1 -l "SetC" setCChecker;
setParent ..;
setParent ..;

global proc chooserWinUI()
{
columnLayout -columnAttach "both" 5 -columnWidth 340 ;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setAColumn;
button -l "SetA"; button -l "SetA"; button -l "SetA";
setParent ..;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setBColumn;
button -l "SetB"; button -l "SetB"; button -l "SetB";
setParent ..;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setCColumn;
button -l "SetC"; button -l "SetC"; button -l "SetC";
setParent ..;

setParent ..;
}

showWindow chooserWin;
//////////////////////////////////////////////////
Wonder if anyone who has the answer could help me to edit the script to make it do what I hope it to do :)

thanks so much in advance.

Zin

Nyro
01-11-2013, 06:16 PM
global proc isCheckedA() {
int $isChecked = `checkBox -q -v setAChecker`;
layout -e -vis $isChecked setAColumn;
}

then edit your checkbox commands to include the command:
-c "isCheckedA";

same with B and C, obviously.

zin64
01-12-2013, 02:06 AM
Thanks so much for the reply. Its working!!
I have edited the script with a function check on the status of the checker box:

///////////////////////////////////////////////////////////////////////////////////////////////
global proc checkerStat(string $thisChecker, string $thisCtrl)
{
int $isChecked = (`checkBox -q -v $thisChecker`);
layout -e -vis $isChecked $thisCtrl;
}

if(`window -exists chooserWin`)
{
deleteUI chooserWin;
}

window -t "Chooser" -widthHeight 340 400 chooserWin;

columnLayout -columnAttach "both" 5 -columnWidth 340;
rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60;
checkBox -v 1 -l "SetA" -cc "checkerStat setAChecker setAColumn" setAChecker;
checkBox -v 1 -l "SetB" -cc "checkerStat setBChecker setBColumn" setBChecker;
checkBox -v 1 -l "SetC" -cc "checkerStat setCChecker setCColumn" setCChecker;
setParent ..;
setParent ..;

global proc chooserWinUI()
{
columnLayout -columnAttach "both" 5 -columnWidth 340 ;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setAColumn;
button -l "SetA"; button -l "SetA"; button -l "SetA";
setParent ..;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setBColumn;
button -l "SetB"; button -l "SetB"; button -l "SetB";
setParent ..;

rowColumnLayout -numberOfColumns 3 -cw 1 60 -cw 2 60 -cw 3 60 setCColumn;
button -l "SetC"; button -l "SetC"; button -l "SetC";
setParent ..;

setParent ..;
}

showWindow chooserWin;

CGTalk Moderation
01-12-2013, 02:06 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.