Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Radiobuttons -en false and then set to true?
  RSS 2.0 ATOM  

Radiobuttons -en false and then set to true?
Rate this thread
 
63941
 
Permlink of this thread  
avatar
  • anthonyd
  • Posted: 27 January 2012 08:08 AM
  • Total Posts: 1
  • Joined: 27 January 2012 07:59 AM

hi,
i am trying to set up a UI that has 2 sets of radioCollections.  depending on the state of the first set, the second will become enabled or not.
cant get the second set to become enabled.  here is the code:

{
 window
;
 
columnLayout;
 
 
// create the first radio collection
 
$radio1 = `radioCollection`;
 
 
// add some radio buttons to the collection
 
$off = `radioButton -label "Off" -onc "updateradio(0)"`;
 
$on  = `radioButton -label "On" -onc "updateradio(1)"`;
 
 
separator -w 50 -style "single";
 
 
// create the second radio collection
 
$radio2 = `radioCollection`;
 
 
// add some radio buttons to the collection
 
$X = `radioButton -label "X" -en false`;
 
$Y = `radioButton -label "Y" -en false`;
 
$Z = `radioButton -label "Z" -en false`;
 
 
// edit the radio collections to set the required radio button
 
radioCollection -edit -select $off $radio1;
 
     
     
proc updateradio(int $arg{
         
if($arg){
             radioButton 
-en true $X;
             
radioCollection -edit -select $X $radio2;
         
}
     }
             
 
// now show the window
 
showWindow;
 
}

thanks
-a



Replies: 0
avatar
  • ldunham1
  • Posted: 28 January 2012 02:19 AM

I had issues with your code, not passing the radioButton strings to the proc so i rewrote it how I would have.

Im assuming this is how you wanted it to work.

if(`window -ex rb_test_win`)
    
deleteUI rb_test_win ;
window rb_test_win ;
columnLayout ;
 
radioCollection rCollection01;
  
radioButton -label "On" -onc "updateradio 1";
  
radioButton -label "Off" -onc "updateradio 0" -sl;
 
separator -w 50 -style "single";
 
radioCollection rCollection02;
  
radioButton -label "X" -ed 0 X_rButton;
  
radioButton -label "Y" -ed 0 Y_rButton;
  
radioButton -label "Z" -ed 0 Z_rButton;
setParent.. ;
showWindow rb_test_win ;

proc updateradio(int $arg)
{
    radioButton 
--en $arg -sl X_rButton;
    
radioButton --en $arg Y_rButton;
    
radioButton --en $arg Z_rButton;
}


Lee Dunham | Character TD
ldunham.blogspot.com

Replies: 0