Window Procedure
Creates a window for the display of graphics or text.
Usage
Window[, window_index]
Input Parameters
window_index — (optional) An integer specifying the index of the newly created window.
*If window_index is omitted, 0 is used as the index of the new window.
*If the value of window_index specifies an existing window, the existing window is deleted and a new window is created.
 
note
If a window with index zero (0) is already open and you call WINDOW with no parameters, the original window zero (0) will be deleted. To avoid this, specify a window_index for the new window or use the Free keyword.
Keywords
Bitmap — (Windows Only) Creates a bitmap stored in the display memory rather than a visible window. This invisible window is created with backing store (see the Retain keyword). See also Appendix B: Output Devices and Window Systems. (Interchangeable with the Pixmap keyword.)
Colors — The maximum number of color table indices to be used. This keyword has effect only if it is supplied when the first window is created. Otherwise, PV‑WAVE uses all of the available color indices.
To use monochrome windows on a color display, use Colors=2 when creating the first window.
 
note
The Win32 driver gives the user access to all 256 colors in the color table regardless of the current video mode. This allows functions like TVRD to obtain consistent results regardless of which color model the Windows video driver is currently using. As a result, use of the Colors keyword to the Window procedure is ignored. On 256-color drivers, Windows reserves 20 colors to use in drawing User Interface components; the PV-WAVE driver compensates by mapping 20 of the color table colors to their nearest RGB color. On high-color graphics drivers, all color table colors are displayed.
 
note
If the X Window System is being used, a negative value for Colors specifies that all but the given number of colors from the shared color table should be allocated.
Free — If nonzero, creates window with largest unused window index. This can be used instead of specifying the window_index parameter.
 
note
The default position of the new window is opposite the current window.
Get_Win_ID — (Windows only) Returns the window ID for the window just created. For example:
WINDOW, Get_Win_ID=New_Win_ID
Get_Xpix_ID — (X Window System only) Returns the X pixmap ID for the pixmap just created. You must use the Pixmap keyword to set this ID. For example:
WINDOW, Get_Xpix_ID=New_Xpix_ID, /Pixmap
Get_Xwin_ID — (X Window System only) Returns the X Window ID for the window just created. For example:
WINDOW, Get_Xwin_ID=New_Xwin_ID
NoMeta — (Windows only) Turns metafiles off for the window. Use this keyword when running animations or displaying images.
A metafile is an internal, vector-based record of all the graphics commands sent to a window. By default, a metafile is kept for each window to speed the redrawing of the window when it is resized. The metafile is also used when printing to avoid resolution problems that occur when printing a bitmap image.
Noretain — (UNIX Only) An obsolete keyword (see the Retain keyword).
Noshow — (Windows only) If present and nonzero, the graphics window is not displayed on the screen.
Pixmap — This keyword specifies that the window being created is actually an invisible portion of the display memory called a pixmap. (Interchangeable with the Bitmap keyword.)
Retain — Specifies how backing store for the window should be handled. Possible values for this keyword are listed below:
*0 — No backing store (same as Noretain keyword).
*1 — The server or window system is requested to make the window retained.
*2 — PV‑WAVE should provide a backing pixmap and handle the backing store directly (X Window System only).
Set_Win_ID — (Windows Only) The window associated with the window ID assigned to this keyword for the PV‑WAVE window. For example:
WINDOW, Set_Win_ID=1234567L
Unlike UNIX, Windows does not allow applications to draw or interact with windows owned by other processes. In order for PV-WAVE to draw into a window created by another application via WINDOW, Set_Win_ID=<window id>, a parent-child relationship must exist between the PV-WAVE process and the process that owns the window. This may be accomplished, for example, by having the process that owns the drawing area spawn the PV-WAVE process as well.
Set_Xpix_ID — (X Window System only) Uses the X pixmap associated with the X Pixmap ID assigned to this keyword for the PV‑WAVE pixmap. This keyword forces the Pixmap keyword to be set. For example:
WINDOW, Set_Xpix_ID=1234567L
Set_Xwin_ID — (X Window System only) Uses the X Window associated with the X Window ID assigned to this keyword for the PV‑WAVE window. For example:
WINDOW, Set_Xwin_ID=1234567L
Title — A scalar string specifying the window’s label. If not specified, the window is given a label of the form “WAVE n”, where n is the index number of the window. For example, to create a window with a label of PV-WAVE Graphics:
WINDOW, Title='PV-WAVE Graphics'
XPos, YPos — The x and y positions of the lower-left corner of the new window, specified in device coordinates.
If no position is specified, the position of the window is determined from the value of window_index, using the following rules:
*Window 0 is placed in the upper right-hand corner.
*Even-numbered windows are placed on the top half of the screen and odd-numbered windows are placed on the bottom half.
*Windows with window_index = 4 * i (e.g., 0, 4, 8, etc.), and windows with window_index = 4 * i + 1 (where i is any whole number) are placed on the right side of the screen. Windows with window_index = 4 * i + 2 (e.g., 2, 6, 10, etc.), and windows with window_index = 4 * i + 3 (where i is any whole number) are placed on the left side of the screen.
XSize — The width of the window, in pixels. (Default: 640)
YSize — The height of the window, in pixels. (Default: 512)
Discussion
You can create any number of windows; however, valid window indices are governed by the following rules. First, windows are allocated in sets of 32. You always have available to you:
*the windows in the currently available window set that are not already used (beginning with the first set (0–31))
*the next available set of 32 windows
For example, the following two commands are both valid because the first window is created from the first available set of windows (031) and the second window is created from the next available set (3263).
; Creates window 1 from window set (0–31).
Window, 1
; Creates window 63 from window set (32–63), next available set.
Window, 63
On the other hand, the following commands break the rule and produce an error because the second window created is not in the next available set after (031); it is in the set (6495).
WINDOW, 1
WINDOW, 64
% Window: Window number out of range or no more
% Window Execution halted at $MAIN$ (WINDOW)
You can use the command:
DEVICE, Window_State = winarr
to determine the number of windows (and sets of windows) that are currently allocated.
You only need to use Window if you want to display more than one PV‑WAVE window simultaneously or to set specific characteristics of windows.
The behavior of Window varies slightly depending on the window system in effect. You can use the DEVICE procedure to change many of the Window procedure’s defaults.
The newly created window becomes the current PV‑WAVE window, and the system variable !D.Window is set to the window index associated with it. (See the WSet procedure for a discussion of the current PV‑WAVE window.)
Example 1
This example creates a single window. The window’s ID is zero (0). The output of any graphics commands appear in this window.
WINDOW, 0
Example 2 (Windows only)
In this example, graphics are output at a size that exceeds the width and height, respectively, of the actual display device. The Xsize and Ysize keywords set the width and height and the Noshow keyword causes the graphics to be created without displaying them on the screen. The WPrint command is used to print the graphics. (This example only works under Windows.)
WINDOW, 1, XSize=3000, YSize=3000, /Noshow
PLOT, x, y
WPRINT, 1
If you want to see the current contents of window 1 in this example at any time, create a visible window with a smaller size and pass the contents of window 1 to the smaller window using the WCopy and WPaste functions. These commands transfer graphics using the Clipboard. For example:
; Copy current window (window 1) to the Clipboard. 
status = WCOPY(1) 
; Create a visible window that will fit on the screen. 
WINDOW, 2 
; Paste the Clipboard contents into the visible window. 
status = WPASTE(2) 
; Set the current graphics window back to window 1 and continue. 
WSET, 1
 
See Also
System Variables: !D.Window
For additional information on PV‑WAVE graphics devices, see Appendix B: Output Devices and Window Systems.
For information on the graphics window Control menu, see the PV‑WAVE User’s Guide.