Scrollable list of strings

The program List.m3 shows how to create a scrollable list of strings using ListVBT. A ListVBT responds to actions of the mouse. The user can select an item or items of the list.

There are several important subprocedure in the ListVBT module. The subprocedure

             insertCells      (at: Cell; n: CARDINAL);
inserts n cells beginning with at. The value of a particular cell can be set with the following subprocedure:
             setValue         (this: Cell; value: REFANY);
The value of a particular cell can be retrieve using:
             getValue         (this: Cell): REFANY;
A call to
             selectOnly       (this: Cell);
makes the given cell the only selected cell. The subprocedure
             getFirstSelected (VAR this: Cell): BOOLEAN;
assigns to the variable this the lowest-numbered selected cell and returns TRUE; if there are no selected cells, it returns FALSE.

Actions in response to mouse clicks and drags in the list require the use of a subtype of the type ListVBT.UniSelector or the type MultiSelector depending on whether only one string or multiple strings are to be selected at a time. The actions to be performed when an item is selected are given in the methods: InsideClick, OutsideClick, InsideDrag and OutsideDrag.

In the program List.m3 a single cell can be selected at a time. A mouse click inside a cell selects the item. Dragging the mouse in the list selects the item under the cursor as long as the mouse is in the cell. Moving the mouse into another cell while holding down a button will select the new cell immediately. Clicks in the list but outside of all the cells (in the extra space that may be present at the bottom on the list) can be caught.

The following images show two views of the application. In each case the appearance of the application is depicted after one of the items in the list has been selected by clicking on it.