14 The fieldsactions Library

The fieldsactions library defines the actions related to the events, related to the interfaceObjects, described in the fields library.

14.1 Using the fieldsactions Library

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

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/fieldsactions'
--- program: descriptor ---
guienv(# bca: @beforeChangeAction;
         ...
      do ...
         bca[] -> appendAction;
         ...
      #)

14.2 Examples of Use of the fieldsactions Fragment

This example illustrates how a beforeChangeAction can be udes to 'eat' every second keystroke in a textField.

Program 12: textfieldactions.bet

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/fields';
INCLUDE '~beta/guienv/fieldsactions';
INCLUDE '~beta/guienv/controls';
(* This is a silly demo that shows how a beforeChangeAction can be
 * used to 'eat' every second keystroke in a textField.
 *)
--- program: descriptor ---
guienv
(# allowEdit: @boolean;
   theWindow: @window
     (# theTextField: @textField
          (# aBeforeChangeAction: @beforeChangeAction
               (# do not allowEdit -> allowEdit #);
             eventHandler::
               (# onBeforeChange::
                    (# do allowEdit -> allow #);
               #);
             open::
               (# 
               do true -> bindBottom -> bindRight;
                  aBeforeChangeAction[] -> appendAction
               #)
          #);
        eventhandler::
          (# onAboutToClose:: (# do terminate #) #);
        open::
          (# 
          do 'BeforeChangeAction Demo' -> title;
             (40,40) -> position;
             (300,300) -> size;
             true -> allowEdit;
             theTextfield.open;
             (300,300) -> theTextfield.size
          #)
     #)
do theWindow.open
#)
[25kb 306x323 GIF]


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