PDA

View Full Version : UI - calling proc from command and using widget vals as args


superduper10000
01-24-2007, 08:36 PM
Hi -- this seems like it should be basic to me but I don't know how to do it :shrug:

Suppose I have someting like:



global proc foo()
{
print ("The value of the slider is " + ?????);
}

window -menuBar 0 -title -width 300 -height 600 -sizeable 1;
columnLayout
floatSliderGrp -label "SomeSlider" -minValue 1 -maxValue 100;
button -command "foo()"
setParent ..;
showWindow;




What's the best way to get the current value of the floatSliderGroup passed to foo() when the button is pressed?

goleafsgo
01-24-2007, 10:57 PM
You probably should just get the name of the UI control and then query it from inside "foo". So either you name the floatSlider with a REALLY specific name so you won't have any conflicts, or you get the name when you create it and then pass that to "foo".

(Haven't actually typed this into Maya so it may not run...)


global proc foo( string $control )
{
float $value = `floatSliderGrp -query -value $control`;
}

...
string $control = `floatSliderGrp`;
button -command ("foo \"" + $control + "\"");
...

superduper10000
01-25-2007, 12:03 AM
Yep that is it - thankx!

CGTalk Moderation
01-25-2007, 12:03 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.