10 Scroll Lists

Scroll lists are used to display an interface object in which the user is able to select elements from a list of elements (e.g. file names).

A scrollList maintains the list of elements and the user is allowed to scroll in the list or to select elements in the list by clicking on them. ScrollList has operations for inserting, deleting and scanning the elements in the list. Furthermore, scrollList maintains a list of the currently selected elements in the list.

TextScrollList is a subpattern of scrollList for maintaining a list of text strings. TextScrollList defines additional operations for manipulating the text strings and for manipulation the text style of the elements in the list.

The following is an example of a textScrollList for selecting in a list of items:

Program 21: scrollinglist.bet

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/scrolllists'
--- program: descriptor ---
guienv
(# scrollListWindow: @window
     (# scrollList: @textScrollList
          (# open::
               (# tmpText: @text;
                  windowSize: @point
               do (5,20)->position;
                  20->append;
                  (for inx: 20 repeat
                       'Item: '->tmpText;
                       inx->tmpText.putint;
                       (inx,tmpText[])->setText
                  for);
                  this(scrollListWindow).size->windowSize;
                  position->windowSize.subtract;
                  (0,15)->windowSize.subtract;
                  windowSize->size;
                  true->bindRight->bindBottom
               #);
             eventhandler::
               (# onSelect::
                    (# do item->gettext->putline #)
               #)
          #);
        eventhandler::
          (# onAboutToClose:: (# do terminate #) #);
        open::
          (#
          do 'scrollingList'->title;
             scrollList.open 
          #)
     #)
do scrollListWindow.open
#)

Program 22: screendumps (Windows 95)

[5kb 123x155 GIF] [8kb 137x155 GIF]


Lidskjalv: User Interface Framework - Tutorial
© 1995-2004 Mjølner Informatics
[Modified: Friday October 27th 2000 at 14:56]