5 Windows

The window pattern describe properties of underlying window system windows. All Lidskjalv windows has a position on the screen, a height and width and a title (shown in the title bar). Windows may be visible on the screen or hidden. Finally, the window may specify the particular event handling to be associated with that window.

The open attribute initializes the window according to the window attributes. During the lifetime of a window, it may shift between being visible on the screen or not. This is controlled by the show and hide attributes. A window may take the control of the entire underlying window system (i.e. act as a modal window) if is is shown using showModal instead of show.

The following creates an ordinary window. The window will be initially visible:

Program 1: simpleWindow.bet

ORIGIN '~beta/guienv/guienv'
--- program: descriptor ---
guienv
(# simpleWindow: @window
     (# open:: 
          (# 
          do (100, 100)->position;
             (300, 100)->size;
             'simpleWindow'->title
          #);
        eventhandler::
          (# onAboutToClose:: (# do terminate #) #);
     #)
do simpleWindow.open
#)

screendump
(Windows NT)

[6kb 231x95 GIF]

Please note the onAboutToClose:: (# do terminate #) part of this small demo program. You will see this in all following demo programs. This small piese of code is included in these demo programs with the intent to make the demo applications terminate, when the window is closed. In realistic applications, this form of termination is very seldom used, since such applications often use a number of windows, and a Quit menu item to actually terminate the application..


Lidskjalv: User Interface Framework - Tutorial
© 1995-2002 Mjølner Informatics
[Modified: Friday October 27th 2000 at 14:56]