Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

window [-backgroundColor float float float] [-closeCommand script] [-defineTemplate string] [-docTag string] [-dockCorner string string] [-dockStation] [-dockingLayout string] [-exists] [-frontWindow] [-height int] [-iconName string] [-iconify boolean] [-interactivePlacement] [-leftEdge int] [-mainWindow] [-maximizeButton boolean] [-menuArray] [-menuBar boolean] [-menuBarCornerWidget string string] [-menuBarResize] [-menuBarVisible boolean] [-menuIndex string uint] [-minimizeButton boolean] [-minimizeCommand script] [-nestedDockingEnabled boolean] [-numberOfMenus] [-parent string] [-resizeToFitChildren boolean] [-restoreCommand script] [-retain] [-sizeable boolean] [-state string] [-title string] [-titleBar boolean] [-titleBarMenu boolean] [-toolbox boolean] [-topEdge int] [-topLeftCorner int int] [-useTemplate string] [-visible boolean] [-width int] [-widthHeight int int] [string]

window is undoable, queryable, and editable.

This command creates a new window but leaves it invisible. It is most efficient to add the window's elements and then make it visible with the showWindow command. The window can have an optional menu bar. Also, the title bar and minimize/maximize buttons can be turned on or off. If the title bar is off, then you cannot have minimize or maximize buttons.

Note: The window will require a control layout of some kind to arrange the controls (buttons, sliders, fields, etc.). Examples of control layouts are columnLayout, formLayout, rowLayout, etc.

Note: This command will clear the uiTemplate stack. Templates for a window need to be set after the window cmd.

Return value

stringName to the window.

In query mode, return type is based on queried flag.

Flags

backgroundColor, closeCommand, defineTemplate, docTag, dockCorner, dockStation, dockingLayout, exists, frontWindow, height, iconName, iconify, interactivePlacement, leftEdge, mainWindow, maximizeButton, menuArray, menuBar, menuBarCornerWidget, menuBarResize, menuBarVisible, menuIndex, minimizeButton, minimizeCommand, nestedDockingEnabled, numberOfMenus, parent, resizeToFitChildren, restoreCommand, retain, sizeable, state, title, titleBar, titleBarMenu, toolbox, topEdge, topLeftCorner, useTemplate, visible, width, widthHeight
Long name (short name) Argument types Properties
-backgroundColor(-bgc) float float float createedit
The background color of the window. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0.
-closeCommand(-cc) script createedit
Script executed after the window is closed.
-defineTemplate(-dt) string create
Puts the command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template.
-docTag(-dtg) string createqueryedit
Attach a tag to the window.
-dockCorner(-dc) string string createmultiuse
Specifies which docking areas occupied the four different corners of the window. By default docking windows on the bottom or top will span the whole window. Use multiple instances of this flag to allow the left and right docking areas to occupy the corners. This method has two arguments: docking corner and docking area. Possible values for docking corner are "topLeft", "topRight", bottomLeft", and "bottomRight". Possible values for docking area are "left", "right", "top", and "bottom".
-dockStation(-ds) create
When set this flag specifies that this window can contain other docked sub-windows.
-dockingLayout(-dl) string createqueryedit
When queried this flag will return a string holding the docking layout information. This string can be set when creating or editing a docking station to restore the previous docking layout. This string is a hexadecimal representation of a binary string and is not meant to be humanly readable, but can be saved and loaded using the optionVar command to restore layouts across sessions of Maya.
-exists(-ex) create
Returns whether the specified object exists or not. Other flags are ignored.
-frontWindow(-fw) query
Return the name of the front window. Note: you must supply the name of any window (the window does not need to exist). Returns "unknown" if the front window cannot be determined.
-height(-h) int createqueryedit
Height of the window excluding any window frame in pixels.
-iconName(-in) string createqueryedit
The window's icon title. By default it is the same as the window's title.
-iconify(-i) boolean createqueryedit
Icon state of the window.
-interactivePlacement(-ip) create
Deprecated flag. Recognized but not implemented. This flag will be removed in a future version of Maya.
-leftEdge(-le) int createqueryedit
Position of the left edge of the window.
-mainWindow(-mw) createqueryedit
Main window for the application. The main window has an 'Exit' item in the Window Manager menu. By default, the first created window becomes the main window.
-maximizeButton(-mxb) boolean createqueryedit
Turns the window's maximize button on or off.
-menuArray(-ma) query
Return a string array containing the names of the menus in the window's menu bar.
-menuBar(-mb) boolean createquery
Adds an empty menu bar to the window. The Qt name of the object will be m_menubar_nameOfTheWindow.
-menuBarCornerWidget(-mcw) string string queryedit
This flag specifies a widget to add to a corner of the parent window. The first argument corresponds to the widget name and the second to the position of the widget. Possible values for widget position are "topLeft", "topRight", "bottomLeft", "bottomRight". In query mode this flag returns all the corner widget names in the following order: topLeft, topRight, bottomLeft, bottomRight. Add the -mbr/-menuBarResize flag to the changeCommand of widget passed (first argument) so that it will always have an appropriate size.
-menuBarResize(-mbr) edit
This flag should be used with the -mcw/-menuBarCornerWidget flag. This is used to resize the menu bar so that the corner widgets are updated.
-menuBarVisible(-mbv) boolean createqueryedit
Visibility of the menu bar (if there is one).
-menuIndex(-mi) string uint edit
Sets the index of a specified menu.
-minimizeButton(-mnb) boolean createqueryedit
Turns the window's minimize button on or off.
-minimizeCommand(-mnc) script createedit
Script executed after the window is minimized (iconified).
-nestedDockingEnabled(-nde) boolean create
Controls whether nested docking is enabled or not. Nested docking allows for docking windows next to other docked windows for more possible arrangement styles.
-numberOfMenus(-nm) query
Return the number of menus attached to the window's menu bar.
-parent(-p) string create
Specifies a parent window or layout which the created window is always on top of. Note: If the parent is a window the created window is not modal, so events are still propagated to the parent window.
-resizeToFitChildren(-rtf) boolean createqueryedit
The window will always grow/shrink to just fit the controls it contains.
-restoreCommand(-rc) script createedit
Script executed after the window is restored from it's minimized (iconified) state.
-retain(-ret) create
Retains the window after it has been closed. The default is to delete the window when it is closed.
-sizeable(-s) boolean createqueryedit
Whether or not the window may be interactively resized.
-state(-st) string createqueryedit
When queried this flag will return a string holding the window state information. This string is a hexadecimal representation of a binary string and is not meant to be humanly readable, but can be saved and loaded using the optionVar command to restore window state across sessions of Maya.
-title(-t) string createqueryedit
The window's title.
-titleBar(-tb) boolean createqueryedit
Turns the window's title bar on or off.
-titleBarMenu(-tbm) boolean createqueryedit
Controls whether the title bar menu exists in the window title bar. Only valid if -tb/titleBar is true. This Windows only flag is true by default.
-toolbox(-tlb) boolean createqueryedit
Makes this a toolbox style window. A Windows only flag that makes the title bar smaller and uses a slightly different display style.
-topEdge(-te) int createqueryedit
Position of the top edge of the window.
-topLeftCorner(-tlc) int int createqueryedit
Position of the window's top left corner.
-useTemplate(-ut) string create
Forces the command to use a command template other than the current one.
-visible(-vis) boolean createqueryedit
The window's visibility.
-width(-w) int createqueryedit
Width of the window excluding any window frame in pixels.
-widthHeight(-wh) int int createqueryedit
Window's width and height excluding any window frame in pixels.

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.

MEL examples

// Make a new window
//
string $window = `window -title "Long Name"
       -iconName "Short Name"
       -widthHeight 200 55`;
columnLayout -adjustableColumn true;
       button -label "Do Nothing";
       button -label "Close" -command ("deleteUI -window " + $window);
setParent ..;
showWindow $window;

// Resize the main window
//
global string $gMainWindow;
window -edit -widthHeight 900 777 $gMainWindow;

// Make a new window and adjust the docking parameters
// Dock a sub-window into the left area
// set allow nested docking to true to allow for more docking configurations like multiple top rows
// set the dockCorner so  the left dock area occupies the top left corner instead of the top docking area.
//
string $window = `window -title "Long Name"
        -iconName "Short Name"
        -widthHeight 200 55
        -dockStation
        -nestedDockingEnabled true
        -dockCorner "topLeft" "left"`;
columnLayout -adjustableColumn true;
        button -label "Do Nothing";
        button -label "Close" -command ("deleteUI -window " + $window);
setParent ..;
showWindow $window;

string $subWindow = `window`;
string $buttonForm = `formLayout -parent $subWindow`;
button -parent $buttonForm;
dockControl -area "left"
    -content $subWindow
    -allowedArea "left"
    -allowedArea "right"
    -dockStation $window;


// Add a menu to the right of the main window's menu bar.
//
setParent "";
string $menuName = "menuTest";
optionMenu -label "test menu" $menuName;
menuItem -label "item 1" -parent $menuName;
menuItem -label "item 2" -parent $menuName;
menuItem -label "item 3" -parent $menuName;
window -e -menuBarCornerWidget $menuName "topRight" $gMainWindow;