Flexible Windows

version 13/130803 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  •     Section: Window Rules

    When a window is opened or redrawn, the window-drawing rules for that window are consulted. The window-drawing rule should (ideally) be able to reconstruct entirely the contents of the window (otherwise, after an UNDO or a RESTORE, information will be lost). Rules for graphical drawing will want to use glk calls to place images--see Simple Graphical Window for examples.

    Text windows are supplied with three important phrases: one to move the focus to a different window, one to clear that window (if required), and one to shift the focus back. A drawing rule for a window designed to display the player's inventory would use all three, and take the following form:

        A window-drawing rule for the side-window (this is the display inventory in side-window rule):
            move focus to side-window, clearing the window;
            try taking inventory;
            return to main screen;

    Any text window can be cleared at any time using

        clear main-window;
        clear side-window;

    Note that Version 9's handling of drawing rules is different from earlier versions', and will require some changes to existing source code:

        1) The "drawing rule" property for windows no longer exists. References to this property should be removed.

        2) The rule preamble for drawing rules should be changed to the form:

            A window-drawing rule for the side-window

        3) Specific invocations of drawing rules should be changed to read as follows:

            follow the window-drawing rules for the side-window