12 The guienvactions Library

As described in chapter 1, the event handling facilities in guienv includes facilities for attaching actions before and after the predefined actions of an interfaceObject. These actions are created as instances of the action pattern. However, in order to be able to access the informations related to the specific event, specialized action patterns are defined for each event type. These actions are defined in this library (and those described in chapter 12 and 13).

12.1 Using the guienvactions Library

Remember that in order to utilize this extension to Lidskjalv, the fragment guienvactions must be included as follows:

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/guienvactions'
--- program: descriptor ---
guienv(# beforeKeyDown: @keyDownAction
           (# do 'Hello' -> putText #);
         ...
      do ...
         beforeKeyDown[] -> prependAction;
         ...
      #)

12.2 Examples of Use of the guienvactions Fragment

12.3 Using keyboard actions

This demo program illustrates the action facilities by attaching actions to be executed before and after onKeyDown events in a edittext control.

Program 10: keyboardactions.bet

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/controls';
INCLUDE '~beta/guienv/guienvactions';
(* This demo shows how to prepend/append actions to keyDown events in
 * an editText control.
 *)
--- program: descriptor ---
guienv
(# theWindow: @window
     (# menubarType::
          (# testMenu: @menu
               (# quitItem: @menuItem
                    (# open::
                         (# do 'Quit' -> name #);
                       eventHandler::
                         (# onSelect::
                              (# do terminate #)
                         #)
                    #);
                  open::
                    (# do quitItem.open;  quitItem[] -> append #)
               #);
             open::
               (# do testMenu.open; testMenu[] -> append #)
          #);
        eventhandler::
          (# onAboutToClose:: (# do terminate #) #);
        editText1: @editText
          (# beforeKeyDown: @keyDownAction
               (# do 'My ' -> puttext #);
             afterKeyDown1: @keyDownAction
               (# do 'is ' -> puttext #);
             afterKeyDown2: @keyDownAction
               (# do 'EditText1' -> putline #);
             open::
               (# 
               do (40,40) -> position;
                  (100,30) -> size;
                  beforeKeyDown[] -> prependAction;
                  afterKeyDown1[] -> appendAction;
                  afterKeyDown2[] -> appendAction
               #);
             eventHandler::
               (# onKeyDown::
                    (# do 'name ' -> puttext #)
               #)
          #);
        open::
          (# 
          do (400,400) -> size;
             editText1.open;
             contents -> target
          #)
     #)
do theWindow.open
#)
[18kb 404x177 GIF]


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