1 The Lidskjalv User Interface Framework

Lidskjalv is a platform independent object-oriented user interface construction toolkit for:

Lidskjalv allows construction of portable user interfaces in such a way that the look-and-feel of the applications, will conform to the standardized look-and-feel of the specific platform.

The framework defines abstractions for all commonly used interface objects, such as windows, menu bars, menus, buttons, text fields, figure items, scrolling lists, etc.

The application programmer does not have to handle user interaction at the event level of the underlying platform, because each interface object takes care of the interactions related to itself. It is the responsibility of the entire framework to ensure that the user interactions (such as mouse button presses, key presses, etc.) are converted internally into invocations of virtual procedures of the appropriate interface object. The only thing the application programmer needs to do is to bind the virtual procedures. All layout properties of interface objects can be manipulated through the Lidskjalv framework.

Following, a realistic example of using Lidskjalv is presented. It is a small text editor with full support for loading, editing, and saving files.

ORIGIN  '~beta/guienv/fields';
INCLUDE '~beta/guienv/stddialogs';
INCLUDE '~beta/basiclib/file';
-- program: descriptor --
guienv
(# theWindow: @window
     (# menubarType::
          (# fileMenu: @menu
               (# textFile: @file;
                  openItem: @menuitem
                    (# eventhandler::
                         (# onSelect::
                              (# theText: @StyledText;
                              do theWindow[]->fileSelectionDialog->textFile.name;
                                 textFile.openRead;
                                 textFile.scan(# do ch->theText.put #);
                                 theText[]->theTextEditor.contents.contents;
                                 textFile.close;
                         #)#);
                       open:: (# do 'Open' -> name #);
                    #);
                  saveItem: @menuitem
                    (# eventhandler::
                         (# onSelect::
                              (# theText: @Text;
                              do textFile.openWrite;
                                 theTextEditor.contents.contents
                                   ->textFile.puttext;
                                 textFile.close;
                         #)#);
                       open::< (# do 'Save' -> name #);
                    #);
                  quitItem: @menuitem
                    (# eventhandler:: 
                         (# onSelect:: (# do Terminate #) #);
                       open::< (# do 'Quit' -> name #);
                    #);
                  open::<
                    (# 
                    do 'File' -> name;
                       openItem.open; openItem[] -> append;
                       saveItem.open; saveItem[] -> append;
                       quitItem.open; quitItem[] -> append;
               #)#);
             open:: (# do fileMenu.open; fileMenu[] -> append #);
          #);
        thetextEditor: @textEditor
          (# open::
              (#
              do theWindow.size->Size;
                 True->bindBottom->bindRight
              #)
          #);
        open:: (# do thetextEditor.open #);
     #);
do theWindow.open;
#)

The following three screen snapshots show how this application appear on the screen after the program has loaded its own source text for editing, and with the menu opened.

Macintosh

[6kb 339x271 GIF]

Windows 95 / Windows NT

[9kb 251x291 GIF]

X Window System

[5kb 325x237 GIF]

This document contains a tutorial on the use of the Lidskjalv user interface framework.

These libraries are collectively referred to as the Lidskjalv user interface framework. Lidskjalv consists of a number of libraries, of which guienv, controls, fields, scrolllists and figureitems will be described in this tutorial. Most Lidskjalv applications will only be using some of these libraries.

The controls library offers the capabilities of interface controls, such as buttons, scrollbars, etc.

The fields library offers the capabilities for displaying bitmaps, rasters and advanced text editing.

The figureitems library offers fairly advanced graphics capabilities, including maintenance of graphical objects on the screen, which can be selected and dragged.

The scrolllists library offers facilities for making scrolling lists as used in e.g. the file dialog.

Besides the basic user interface libraries, as described above, the Lidskjalv framework contains a series of utility libraries (not described in this manual). These utility libraries can be found in the utils subdirectory of the Lidskjalv directory tree.

This tutorial will contain screen dumps mainly from the Windows 95 and Windows NT platforms. All demos can be recompiled on the other supported platforms, resulting in similar windows, just with the look-and-feel of that platform.

1.1 Further Readings

This tutorial is accompanied with a reference manual for the Lidskjalv framework: Mjølner System: Lidskjalv: User Interface Framework - Reference Manual, [MIA 94-27]. User's manuals for the Mjølner System on the different platforms are also available Furthermore, a reference manual for the BETA compiler is available: Mjølner System: Compiler Reference, [MIA 90-02]. Finally, a reference manual is available on the basic libraries: Mjølner System: Basic Libraries, [MIA 90-08]. The reader is advised to consult these documents (along with the other Mjølner BETA Manuals) as well as this tutorial.


Lidskjalv: User Interface Framework - Tutorial
© 1995-2004 Mjølner Informatics
[Modified: Tuesday September 4th 2001 at 9:34]