REBOL Document

View - Function Summary


Summary:

Displays a window face.

Usage:

view view-face

Arguments:

view-face - The view-face argument. (must be: object)

Refinements:

/new - Creates a new window and returns immediately

/offset - The offset refinement.

xy - Offset of window on screen (must be: pair)

/options - The options refinement.

opts - Window options [no-title no-border resize] (must be: block word)

/title - The title refinement.

text - Window bar title (must be: string)

Description:

The view function creates and updates windows. It takes a face as its argument. The contents of the window is determined from a face that holds a block of the graphical objects. The window face is normally created with the LAYOUT function, but faces can be constructed directly from face objects and displayed as well.

The example below opens a window and displays some text and a button.


    view layout [
        h2 "The time is currently:"
        h3 form now
        button "Close" [unview]
    ]

The position and size of the window is determined from the face to be displayed. In the example above, the size of the window is automatically computed by the LAYOUT function. The window is shown in the default position in the upper left area of the screen.

The window's caption will be default be the title of the script that is being run. To provide a different caption, use the /title refinement and a string.


    view/title layout [h1 "Window"] "A Window"

The first use of view within an application is special. It displays the window and initializes the graphical interface system. Subsequent calls to VIEW update the window, they do not create new windows unless the /new refinement is provided.


    view layout [
        button "Change" [
            view layout [button "Stop" [unview]]
        ]
    ]

The first call to the VIEW function will not return immediately. At that point your code becomes event driven, calling the functions associated with various faces. While the first call to VIEW remains active, any other calls to VIEW will return immediately. The first call will return only after all windows have been closed.

Additionally, calls to view can specify options, such as whether the window has borders and is resizable. Single options are provided as a word and multiple options are specified in a block.


    out: layout [vh1 "This is a window."]
    view/options out [resize no-title]

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.
unview - Closes window views, except main view.


<Back | Index | Next>

Copyright 2004 REBOL Technologies