1. Home
  2. DCLOSE directive

DCLOSE directive

Closes windows in the Genstat Graphics Viewer.

No options

Parameter

WINDOW = scalar Window number to close; if unset, closes all the windows and the Viewer itself

Description

The Genstat Graphics Viewer displays the graphs sent to DEVICE 1 in windows, one at a time. The open windows are always numbered sequentially from one, and closing a window causes subsequent windows to be renumbered.

You can use DCLOSE to close any of these windows. The WINDOW parameter specifies which ones to close. A positive integer n closes the nth window. A negative integer -n closes the nth window from the top: for example WINDOW=-1 closes the most recently plotted graph. A zero value closes all the graphs, but leaves the viewer open. This will make the display of subsequent graphs faster. Finally, if WINDOW is not set, the Viewer itself is closed (and hence all windows). This may be useful to ensure that all graphs from any previous runs have been closed. For example, you may want to save all open graphs to a PDF file, and include only the graphs from the current run.

If a list of windows is given in a single call, windows will be closed using the window numbers assigned at the start of the DCLOSE call. For example

DCLOSE 1...5

closes the first 5 windows. If DCLOSE is called several times, the window numbers are always relative to the windows open at the time each DCLOSE is called. So the commands

DCLOSE 1 : DCLOSE 2

would close the first and third windows, as after the first DCLOSE, window 3 becomes window 2.

Options: none.
Parameter: WINDOW.

See also

Directive: DVIEW.
Commands for: Graphics.

Example

" Close viewer to initialise plots."
DCLOSE 
" Plot 50 spirals."
SCALAR    N; VALUE=50
VARIATE   [VALUES=1...N] Index
CALCULATE t = Index + 4
&         X = (t)**(2/3)*COS(C('pi')*(t/3)**(2/3))
&         Y = (t)**(2/3)*SIN(C('pi')*(t/3)**(2/3))
PEN       1,2; SYMBOL='circle'; COLOUR='black','red'; CFILL='match'; SIZE=0.5,2
FOR       [NTIMES=N; INDEX=i]
  CALC    Pen = 1 + (Index == i)
  DGRAPH  [WINDOW=3; KEY=0] Y; X; PEN=Pen
ENDFOR
" Wait to allow graphs to display in viewer."
%SLEEP    10 
" Close the graphs from the top one at a time."
FOR [NTIMES=N]
  DCLOSE  -1
  %SLEEP  1
ENDFOR
Updated on February 6, 2023

Was this article helpful?