View Single Post
# 2 04-03-2014 , 07:13 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
In cases of UI elements that will be accessed by procs outside the main proc, I explicitly name them.

So instead of...

string $Button_ShowText = `button -label "Show text on Form" -w 160 -h 25 -command ShowTextOnForm Button_ShowText`;

I would use..

button -label "Show text on Form" -w 160 -h 25 -command ShowTextOnForm Button_ShowText abc_myButton;

So now the button can be referred to by any procedure.

Also it's a good idea to give unique names to anything with a global scope. I can see WindowGUI becoming a problem if you start writing more scripts. Try prefixing it with something that describes the family of scripts it belongs to, like beanCounter_windowGUI or something.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::