View Full Version : UI help

06 June 2007, 03:13 PM
global proc aasLightBox()

string $aasLightBox = `window -title ("aasLightBox - v1.5") -wh 430 250`;
// Creates Render Layers
frameLayout -label "Render Layers" -borderStyle "etchedIn" -font "boldLabelFont" -collapsable 0 -w 425;
string $myTextFieldButtonGrp;
string $myButtonCommand = "createRenderLayer -name (`textFieldButtonGrp "+" -q -text $myTextFieldButtonGrp`)";

$myTextFieldButtonGrp = `textFieldButtonGrp
-label "Name"
-text ""
-buttonLabel "Create"`;
textFieldButtonGrp -e -bc $myButtonCommand $myTextFieldButtonGrp;
setParent ..;
setParent ..;

frameLayout -label "Render Stats" -borderStyle "etchedIn" -font "boldLabelFont" -collapsable 0 -w 425;
gridLayout -numberOfRowsColumns 1 8 -cellWidthHeight 52 40;
symbolButton -image "S:/Morgue/melScripts/icons/cShadows.bmp" -command "castsShadows" -ann "castShadows";
symbolButton -image "S:/Morgue/melScripts/icons/rShadows.bmp" -command "receiveShadows" -ann "receiveShadows";
symbolButton -image "S:/Morgue/melScripts/icons/mBlur.bmp" -command "mBlur" -ann "Motion Blur";
symbolButton -image "S:/Morgue/melScripts/icons/vIReflections.bmp" -command "visibleInReflections" -ann "visibleInReflections";
symbolButton -image "S:/Morgue/melScripts/icons/vIRefractions.bmp" -command "visibleInRefractions" -ann "visibleInRefractions";
symbolButton -image "S:/Morgue/melScripts/icons/pVisibility.bmp" -command "primaryVisibility" -ann "Primary Visibility";
symbolButton -image "S:/Morgue/melScripts/icons/allOff.bmp" -command "allOff";
symbolButton -image "S:/Morgue/melScripts/icons/allOn.bmp" -command "allOn";
setParent ..;
setParent ..;
showWindow $aasLightBox;

This code above is baffling me. When I run the script everything pops up the way it should. But when I select a object to test the render layer part of my script and excute the button. It gives me this error:
Error: $myTextFieldButtonGrp" is an undeclared variable.
Which this error isn't that baffling, but the baffling part is that I excute the same UI script but without the global proc aasLightBox() The render layer script seems to work. So my main question is why is it not working when the UI script is withing the global proc?

06 June 2007, 05:29 PM
$myTextFieldButtonGrp is only variable and has no value.

string $myTextFieldButtonGrp;

.... so you need to give the control a name.

string $myTextFieldButtonGrp = "myTFB_GRP_1";
string $myButtonCommand = "createRenderLayer -name (`textFieldButtonGrp "+" -q -text $myTextFieldButtonGrp`)";

textFieldButtonGrp -label "Name" -text "" -buttonLabel "Create" $myTextFieldButtonGrp;
textFieldButtonGrp -e -bc $myButtonCommand $myTextFieldButtonGrp;

CGTalk Moderation
06 June 2007, 05:29 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.