WINDOW Procedure

Note: Please see the WINDOW function, which replicates the functionality of this routine and offers an interactive interface.

The WINDOW procedure creates a window for a Direct Graphics window 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 WSHOW Procedure for a discussion of the current IDL window.)

The behavior of WINDOW varies slightly depending on the window system in effect.

Examples

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'

Syntax

WINDOW [, Window_Index] [, COLORS=value] [, /FREE] [, /PIXMAP] [, RETAIN={0 | 1 | 2}] [, TITLE=string] [, XPOS=value] [, YPOS=value] [, XSIZE=pixels] [, YSIZE=pixels]

Arguments

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.

Keywords

COLORS

Note: This keyword is ignored under Microsoft Windows.

The maximum number of color table indices to be used when drawing. This keyword 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 in X Windows, 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.

Although this keyword is ignored under Microsoft Windows, we could use the following code to use a monochrome window on all platforms:

WINDOW, COLORS=2 ; ignored on Windows

white=!D.N_COLORS-1

PLOT, FINDGEN(20), COLOR=white

FREE

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.

PIXMAP

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

Note: On Microsoft Windows systems, the number of pixmap windows that can be created is limited by system GDI resources. The number of pixmap windows IDL can create is constrained by the total amount of GDI memory, the amount of GDI memory used by other applications, and the size of the IDL pixmap windows.

RETAIN

Set this keyword to 0, 1, or 2 to specify how backing store should be handled for the window:

TITLE

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:

WINDOW, TITLE='IDL Graphics'

XPOS

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 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

WINDOW, XPOS = 0, YPOS = 0

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

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

Note: The order of precedence (highest to lowest) for positioning windows is: XPOS/YPOS keywords to WINDOW, the value of the IDL_GR_WIN_LAYOUT preference (Microsoft Windows only), and the optional index argument to WINDOW. Also realize that setting LOCATION is only a request to the Window manager and may not always be honored due to system peculiarities.

YPOS

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

XSIZE

The width of the window in pixels.

YSIZE

The height of the window in pixels.

Version History

Original

Introduced

See Also

WDELETE, WSHOW Procedure