The WINDOW procedure creates a window for the display of graphics or text. It is only necessary to use WINDOW if more than one simultaneous window or a special size window is desired because a window is created automatically the first time any display procedure attempts to access the window system. The newly-created window becomes the current window, and the system variable !D.WINDOW is set to that window's window index. (See the description of the WSET procedure for a discussion of the current IDL window.)

The behavior of WINDOW varies slightly depending on the window system in effect. See the discussion of IDL graphics devices in IDL Graphics Devices for additional details.

Calling Sequence

WINDOW [, Window_Index]



The window index for the newly-created window. A window index is an integer value between 0 and 31 that is used to refer to the window. If this parameter is omitted, window index 0 is used. If the value of Window_Index specifies an existing window, the existing window is deleted and a new one is created. If you need to create more than 32 windows, use the FREE keyword described below.



The maximum number of color table indices to be used when drawing. This parameter has an effect only if supplied when the first window is created. If COLORS is not present when the first window is created, all or most of the available color indices are allocated depending upon the window system in use.

To use monochrome windows on a color display use COLORS = 2, when creating the first window. One color table is maintained for all windows. A negative value for COLORS specifies that all but the given number of colors from the shared color table should be allocated.


Set this keyword to create a window using the smallest unused window index above 32. If this keyword is present, the Window_Index argument can be omitted. The default position of the new window is opposite that of the current window. Using the FREE keyword allows the creation of a large number of windows. The system variable !D.WINDOW is set to the index of the newly-created window.


Set the PIXMAP keyword to specify that the window being created is actually an invisible portion of the display memory called a pixmap.


Set this keyword to zero, one, or two to specify how backing store should be handled for the window. RETAIN=0 specifies no backing store. RETAIN=1 requests that the server or window system provide backing store. RETAIN=2 specifies that IDL provide backing store directly. See Backing Store for details.


A scalar string that contains the window's label. If not specified, the window is given a label of the form "IDL n ", where n is the index number of the window. For example, to create a window with the label "IDL Graphics", enter:



The X position of the window, specified in device coordinates. On Motif platforms, XPOS specifies the X position of the lower left corner and is measured from the lower left corner of the screen. On Windows and Macintosh platforms, XPOS specifies the X position of the upper left corner and is measured from the upper left corner of the screen. That is, specifying


will create a window in the lower left corner on Motif machines and in the upper left corner on Windows and Macintosh machines.

If no position is specified, the position of the window is determined from the value of Window Index using the following rules:


The Y position of the window, specified in device coordinates. See the description of XPOS for details.


The width of the window in pixels.


The height of the window in pixels.


Create graphics window number 0 with a size of 400 by 400 pixels and a title that reads "Square Window" by entering:

WINDOW, 0, XSIZE=400, YSIZE=400, TITLE='Square Window'

See Also