REBOL Document

Unview - Function Summary


Summary:

Closes window views, except main view.

Usage:

unview

Refinements:

/all - Close all views, including main view

/only - The only refinement.

face - Close a single view (must be: object)

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

Related:

flash - Flashes a message to the user and continues.
hide - Hides a face or block of faces.
inform - Display an exclusive focus panel for alerts, dialogs, and requestors.
show - Display a face or block of faces.
view - Displays a window face.


<Back | Index | Next>

Copyright 2004 REBOL Technologies