2010

Table Of Contents
Use conditional statements to check the existence of a window
Use a built-in Maya procedure
Link a procedure to a user interface
Creating a window
The first step in creating custom user interfaces is to create a window. This
window contains the elements of the user interface such as text, buttons and
other controls.
To create a window
1 Type the following commands into a MEL tab of the Script Editor.
window -resizeToFitChildren 1; showWindow;
A window appears.
The -resizeToFitChildren flag on the window command specifies that
the window automatically resizes to fit all of the elements within the
window. This flag must have a value: a value of 1 turns on the flag, a
value of 0 turns it off.
When you create a window, it is not visible until you use the showWindow
command. The showWindow command without any arguments makes the
last window created visible.
2 Close the window clicking the X in the upper right hand corner.
Referencing controls
When creating windows with MEL scripting, you must ensure that every
window and user interface control is given a unique name. If you do not
explicitly give a window a name, it gets a default name. (In the previous
procedure, the name of the window was window1, even though you didnt
684 | Chapter 13 Scripting in Maya