PDA

View Full Version : button state


patbb
10-18-2005, 11:33 PM
Hi!

Just a quick question on a simple script window.

if the "sp1" object is selected, the "sp1" button is down.

if the "sp1" object isn't selected, the "sp1" button is up.

Thank you very much!

-p

Winner
10-20-2005, 08:16 PM
off the top of my hat not sure if thats possible in Mel. I think youre thinking of a `checkButton` in Maxscript.

Just use a checkBox - it does the same thing practically.

Segmoria
10-21-2005, 11:41 AM
Based on the MEL command reference, buttons don't seem to have a -value flag so you can manually adgust their state whevener you want.
So you might be better off using an another control object like the checkbox as Winner mentioned.
You can use something like that:

string $window = `window`;
columnLayout;
checkBox -label "sp1 selected" -value 0 checkBox_sp1;
checkBox -label "sp2 selected" -value 0 checkBox_sp2;
showWindow $window;

string $selectedObj[] = `ls -selection`;
if (`size($selectedObj)`==1) // checking if more than one objects are selected
{
if ($selectedObj[0] == "sp1")
{
checkBox -e -value 1 checkBox_sp1;
}
if ($selectedObj[0] == "sp2")
{
checkBox -e -value 1 checkBox_sp2;
}
}

CGTalk Moderation
10-21-2005, 11:41 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.