Example

Open Two Windows

Author: Carl Sassenrath
This example requires REBOL/View
Return to REBOL Cookbook

Open two windows next to each other. Each window contains text and a button that will close its window.

Define the layouts for both windows:


    window1: layout [
        backcolor linen
        h2 "Window 1"
        text 300 {Now is the time for all good computers to
            come to the aid of their programmers.
        }
        button "Close 1" [unview/only window1]
    ]

    window2: layout [
        backcolor sky
        h2 "Window 2"
        text 300 {Whether it is nobler in the mind to suffer
            the slings and arrows of traditional languages.
        }
        button "Close 2" [unview/only window2]
    ]

Locate the second window next to the first window and display both windows.


    window2/offset: window1/offset + (window1/size * 1x0) + 10x0

    view/new window1
    view/new window2
    do-events

The script will terminate only after both windows have been closed.


2006 REBOL Technologies REBOL.com REBOL.net