REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: unview

Description

The UNVIEW function is used to close a window previously opened with the VIEW function. By default, the last window that has been opened will be closed. To close a specific window, use the /only refinement and specify the window's face (that which was returned from a layout, for example). All windows can be closed with the /all refinement.

The example below opens a window that displays a Close button. Clicking on the button will evaluate the UNVIEW function and the window will be closed.

view layout [button "Close" [unview]]

Note that the VIEW function will not return until all windows have been closed. (Use VIEW/new to return immediately after the window is opened.)

The next example will open two windows, then use UNVIEW/only to close each one separately.

out1: layout [button "Close 2" [unview out2]]
out2: layout [button "Close 1" [unview out1]]
view/new out1
view/new out2
do-events

You could have closed both windows with the line:

unview/all


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin