View Full Version : Linking sliders?
Renderizer 11-17-2004, 05:15 PM Hi all, here comes another noob question!
Is it possible to link sliders together depending on the condition of a radio button?
Say, I have two radio buttons called 'Uniform' and 'Non-Unifrom', plus three slider for X,Y,Z.
Now if I choose the 'Uniform' option, I'd like to link the Y and Z sliders to the value of the X slider, so that Y and Z move with the X slider. Other than that, maybe the Y and Z sliders could be greyed out?
Thanks!
Mario
|
|
macaroniKazoo
11-17-2004, 08:37 PM
you can call commands when a new radio button is selected - look into the -sc flag, or perhaps its a flag on the radioCollection control, i'm not sure. but its either on the radioButton, or radioCollection. so basically you could have the sliders connected to the attributes you want, and when the radio button is changed, you could have a proc that connects the second two sliders to the x or whatever.
or you could grey them out as well...
goleafsgo
11-18-2004, 12:22 PM
This may get you started...
global proc myXDragged()
{
if (`radioButton -q -select MyUniformRadioButton`)
{
float $value = `floatSliderGrp -q -value MyXSlider`;
floatSliderGrp -e -value $value MyYSlider;
floatSliderGrp -e -value $value MyZSlider;
}
}
global proc myUniformSelected()
{
float $value = `floatSliderGrp -q -value MyXSlider`;
floatSliderGrp -e -value $value -enable false MyYSlider;
floatSliderGrp -e -value $value -enable false MyZSlider;
}
global proc myNonUniformSelected()
{
floatSliderGrp -e -enable true MyYSlider;
floatSliderGrp -e -enable true MyZSlider;
}
global proc createConnectSlidersExample()
{
string $window = `window -title "Connect Sliders Example"`;
columnLayout;
radioCollection MyRadioCollection;
radioButton -label "Uniform" -onCommand "myUniformSelected" MyUniformRadioButton;
radioButton -label "Non-Uniform" -onCommand "myNonUniformSelected" MyNonUniformRadioButton;
setParent ..;
floatSliderGrp -label "X Value" -field true -minValue -10.0 -maxValue 10.0 -dragCommand "myXDragged" MyXSlider;
floatSliderGrp -label "Y Value" -field true -minValue -10.0 -maxValue 10.0 MyYSlider;
floatSliderGrp -label "Z Value" -field true -minValue -10.0 -maxValue 10.0 MyZSlider;
radioCollection -edit -select MyNonUniformRadioButton MyRadioCollection;
showWindow $window;
}
createConnectSlidersExample
Renderizer
11-18-2004, 12:34 PM
Well, I finally came around to do it via the radio button's -cc flag, which I use to call a procedure upon changing the button.
Thanks a lot for your tips!
Mario
CGTalk Moderation
01-19-2006, 09:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.