Routines (alphabetical) > Routines: W > WSET Procedure

# WSET Procedure

The WSET procedure selects the current Direct Graphics window. Most IDL graphics routines do not explicitly require the IDL window to be specified. Instead, they use the window known as the current window. The window index number of the current window is contained in the read-only system variable !D.WINDOW. WSET only works with devices that have windowing systems.

## Examples

Create two IDL windows and then draw different data into each:

; Create two windows
WINDOW, 1 & WINDOW, 2
; Set the current window to window 1 and display an image:
WSET, 1 & TVSCL, DIST(400)
; Set the current window to window 1 and display a plot:
x = 2*!PI/100 * FINDGEN(100)
WSET, 2 & PLOT, x, SIN(x)

## Syntax

WSET [, Window_Index]

## Arguments

### Window_Index

This argument specifies the window index of the window to be made current. If this argument is not specified, a default of 0 is used.

If you set Window_Index equal to -1, IDL will try to locate an existing window to make current, ignoring any managed draw widgets that may exist. If there is no window to make current, WSET changes the value of the WINDOW field of the !D system variable to -1, indicating that there are no current windows.

If there are no existing IDL windows, and you call WSET without the Window_Index argument or with a Window_Index of 0, a new window with the index 0 is opened. Calling WSET with a Window_Index for a window that does not exist, except for window 0, results in a “Window is closed and unavailable” error message.

## Keywords

None

## Version History

Original | Introduced

## See Also

WDELETE, WINDOW, WSHOW Procedure