Window Programming

  • Main Home Page

  • Features

  • Sequential Composition and Explicit Thread Creation

  • Objects

  • Exception Handling

  • Syntax Improvements

  • Standard Modules

  • Window Programming

  • Finite Domain Constraints

  • Record Constraints

  • Efficiency

  • Tools

  • Documentation

  • Download


  • General

    It should be straightforward to adapt programs using the module Tk, since most changes are conservative.

    The first thing you will notice is that the efficiency with respect to both memory and runtime has been improved considerably.

    The Tk Module

    Here is a list of improvements and changes of the Tk module:

    Actions

    An action can be either a procedure P or a pair O#M of an object O and a message M. Whenever the action is invoked, P is applied or O is applied to M.

    Event Arguments

    Arguments for events are not longer limited to be strings, they can be specified together with an appropriate type. For example:

    {C tkBind(event:  '<1>' 
              args:   [int(x) int(y)]
              action: proc {$ X Y} {Show X+Y} end)}
    

    specifies that the action procedure is invoked with integers for the x- and y-coodinates of the mouse pointer.

    Menu Entries

    The module provides the following classes for menu entries:

    Tk.menuentry.separator
    Tk.menuentry.command
    Tk.menuentry.checkbutton
    Tk.menuentry.cascade
    Tk.menuentry.radiobutton
    Tickles

    New tickles are true, false, and unit that correspond to the virtual strings 1, 0, and the empty string.

    The color tickle c(R G B) expands to a string specifying a color by integer values between 0 and 255 for its red, green, and blue part.

    The batch tickle b(Tcls) expands to a string, where the strings obtained by expanding the elements of the list Tcls are concatenated and separated by a space character.

    Closing Widgets

    Widgets are now closed by applying them to the message tkClose. Closing a widget closes all its sub-widgets. In contrast to Oz 1 all sub-widgets are closed implicitly without applying them to the message tkClose theirselves.

    Applying a closed widget to a message other than tkClose raises an exception.

    The TkTools Module

    The new module TkTools offers procedures and classes that support graphical abstractions which occur in a large number of applications and are not directly supported by abstractions provided by the Tk module.

    Currently, the module includes support for:

    Dialogs
    Menu Bars
    Text Frames
    Notebooks
    Number Entries

    Further Information

    Unfortunately, the document Window Programming in Oz is still in a very early draft state. However you can find it here.

    Another source of information are the programs that come with the system. A good idea could be to look at the code for the Explorer, the Panel, the Browser, and the demos.


    Christian Schulte