The Toolkit 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 Toolkit.
A realistic example of using Lidskjalv is presented in the following. It is a small text editor with full support for loading, editing, and saving files. The two screen snapshots show how this application appears on the screen on Windows NT and on Motif platforms after the program has loaded its own source text for editing, and with the menu opened.
ORIGIN '~beta/guienv/fields'; INCLUDE '~beta/guienv/stddialogs' '~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 (# while::< (# do true->value #) 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; True -> bindRight #)#); open::< (# do thetextEditor.open #); #);
Mjølner System: Lidskjalv - Tutorial.
Mjølner System: Lidskjalv - Reference Manual.