Go to: Synopsis. Return value. Flags. MEL examples.
windowPref [-enableAll boolean] [-exists] [-height
int] [-leftEdge int]
[-loadAll] [-parentMain boolean] [-remove] [-removeAll]
[-restoreMainWindowState
string] [-saveAll] [-saveMainWindowState string]
[-topEdge int] [-topLeftCorner int int] [-width int] [-widthHeight int int]
string
windowPref is undoable, queryable, and editable.
Create or modify preferred window attributes. The size and position
of a window is retained during and between application sessions. A
default window preference is created when a window is closed.
Window preferences must be named and, consequently, only affect the
window with a matching name. Note that window preferences are not
applied to the main Maya window nor the Command window.
None
In query mode, return type is based on queried flag.
enableAll, exists, height,
leftEdge, loadAll, parentMain, remove,
removeAll, restoreMainWindowState, saveAll, saveMainWindowState, topEdge, topLeftCorner, width, widthHeight
Flag can appear in Create mode of
command |
Flag can appear in Edit mode of command |
Flag can appear in Query mode of command |
Flag can be used more than once in a
command. |
// Check if the window exists.
//
if (`window -exists ExampleWindow`) deleteUI -window ExampleWindow;
// Create a window.
//
window ExampleWindow;
columnLayout;
text -label "Size and position the window before closing it.";
button -label "Close" -command ("deleteUI -window ExampleWindow");
showWindow ExampleWindow;
// When the window is closed a window preference object is
// created for the window. It has the same name as the window
// object.
//
windowPref -exists ExampleWindow;
// Query the window preference size and position.
//
windowPref -query -topLeftCorner ExampleWindow;
windowPref -query -widthHeight ExampleWindow;
// Create a window with the same name. When it is shown
// it will be sized and positioned according to the
// window preference.
//
if (`window -exists ExampleWindow`) deleteUI -window ExampleWindow;
window ExampleWindow;
columnLayout;
text -label "Size and position the window before closing it.";
button -label "Close" -command ("deleteUI -window ExampleWindow");
showWindow ExampleWindow;
// Delete the window preference and the window will have a
// default size and position.
//
windowPref -remove ExampleWindow;
// Create the window one last time.
//
if (`window -exists ExampleWindow`) deleteUI -window ExampleWindow;
window ExampleWindow;
columnLayout;
text -label "Size and position the window before closing it.";
button -label "Close" -command ("deleteUI -window ExampleWindow");
showWindow ExampleWindow;