mccollom73
04-07-2011, 12:04 AM
Hey everyone,
I have been trying to run a command through an optionMenuGrp. This is what I got so far.
global proc testScript()
{
int $width= 80;
int $height= 70;
string $title = "Test";
// create window
if(`window -q -exists testScriptWin`)
{
deleteUI testScriptWin;
}
string $win= `window -wh $width $height -title $title -retain testScriptWin`;
string $forumTest = `formLayout`;
string $characterName = `optionMenuGrp -label "Name: "`;
string $one, $two, $three, $four;
$one = `menuItem -label "One"`;
$two = `menuItem -label "Two"`;
$three = `menuItem -label "Three"`;
$four = `menuItem -label "Four"`;
setParent ..;
setParent ..;
optionMenuGrp -edit -changeCommand ("updateGUI" + $characterName)
$characterName;
showWindow $win;
}
global proc updateGUI(string $characterName)
{
if ($characterName) return;
string $value = `optionMenuGrp -query -value $characterName`;
global string $PrefName;
if ("one" == $value)
{
$PrefName = "One";
print $PrefName;
}
else if ("two" == $value)
{
$PrefName = "Two";
print $PrefName;
}
else if ("three" == $value)
{
$PrefName = "Three";
print $PrefName;
}
else if ("four" == $value)
{
$PrefName = "Four";
print $PrefName;
}
}
testScript;
this is the error I'm getting.
Error: Cannot find procedure "updateGUItestScriptWin|formLayout97|optionMenuGrp1"
I know I'm doing something wrong, I always feel embarrassed posting scripting questions like this. I just get stuck at a certain spot, and don't know where to go from there besides you guys. Thank you in advance.
Josh
I have been trying to run a command through an optionMenuGrp. This is what I got so far.
global proc testScript()
{
int $width= 80;
int $height= 70;
string $title = "Test";
// create window
if(`window -q -exists testScriptWin`)
{
deleteUI testScriptWin;
}
string $win= `window -wh $width $height -title $title -retain testScriptWin`;
string $forumTest = `formLayout`;
string $characterName = `optionMenuGrp -label "Name: "`;
string $one, $two, $three, $four;
$one = `menuItem -label "One"`;
$two = `menuItem -label "Two"`;
$three = `menuItem -label "Three"`;
$four = `menuItem -label "Four"`;
setParent ..;
setParent ..;
optionMenuGrp -edit -changeCommand ("updateGUI" + $characterName)
$characterName;
showWindow $win;
}
global proc updateGUI(string $characterName)
{
if ($characterName) return;
string $value = `optionMenuGrp -query -value $characterName`;
global string $PrefName;
if ("one" == $value)
{
$PrefName = "One";
print $PrefName;
}
else if ("two" == $value)
{
$PrefName = "Two";
print $PrefName;
}
else if ("three" == $value)
{
$PrefName = "Three";
print $PrefName;
}
else if ("four" == $value)
{
$PrefName = "Four";
print $PrefName;
}
}
testScript;
this is the error I'm getting.
Error: Cannot find procedure "updateGUItestScriptWin|formLayout97|optionMenuGrp1"
I know I'm doing something wrong, I always feel embarrassed posting scripting questions like this. I just get stuck at a certain spot, and don't know where to go from there besides you guys. Thank you in advance.
Josh
