Editable Lists
Volume Number: 6
Issue Number: 4
Column Tag: Pascal Procedures
Editable Lists & User Items 
By David Willcox, Chicago, IL
Note: Source code files accompanying article are located on MacTech CD-ROM orsource code disks.
Editable Lists and Other Dialog User Items
David Willcox is an Assistant Professor of Chemical Engineering at the
University of Illinois at Chicago. He programs several tools for Data Acquisition in his
lab. WillStein resulted from the development of a Gas Chromatography workstation
running in conjunction with LabVIEW from National Instruments. The current article
contains a few of the utilities required for this project.
I have always wished that spreadsheets could be edited directly without having to
first click in the cell and then click again in the edit window to insert a single
character. In this article, I will combine the List Manager and TextEdit to provide an
editable list in a Dialog. In addition, this demo shows:
• how to avoid writing CDEF’s for the Editable List and for Pop Up menu items.
• validating the entry of numeric information while the user is typing
The List Manager and User Interface Woes
The List Manager provides a simple means for displaying a list of one or two
dimensional data in a table. Previous articles in MacTutor have discussed using the
List Manager for creating a spreadsheet, or for creating LDEF’s to modify the operation
of a list [MacTutor March 1989 and June 1980, respectively].
The standard List Manager only allows a list to be displayed, and a selection to be
made from the list. There is no means provided for editing a list once it has been
created. This has apparently caused spreadsheet designers to provide an “Edit
Window” at the top of the screen for data entry. However, this is a nuisance if you
need to make a small change to the middle of a string. To do this, you must first select a
cell (with the mouse) and then move the mouse in order to click in the edit window to
make the desired change.
This reminds me of the old command-line interface where a specific portion of
the screen is devoted to commands and the rest of the screen is used for display. This
seems like a throw back to the pre-Macizoan millennia. Cricket Graph is the only
program that I have seen which allows a list to be edited directly. I consider this more
in line with the Macintosh User Interface Guidelines of providing as direct an interface
as possible for the user.
Figure 1. The Editable List Dialog
Defining the User Interface
It would have been nice if Apple had incorporated TextEdit into the List Manager.
An additional flag could have been provided to allow a list to be editable just like
allowing the list to autoscroll. However, the List Manager was designed for use in the
Standard File Dialogs, et al, and I am grateful to Apple for standardizing those routines
and providing them to everyone else even if they lack a few nifty features.
However, this leaves us with the problem of inventing a User Interface for an
editable list, and then programming it to contain as many of these features as possible.
This section defines the desired user interface, and the next section presents a means
for programming it.
The user interface should be as direct as possible. Clicking in a cell should cause
the insertion point to be placed at that point. Secondly, all previous List Manager
operations should remain the same. For example, the tab, return, and arrow keys
should still allow the user to move from cell to cell. However, this conflicts with
TextEdit because there the cursor keys are used to move the insertion point. Also,
using the return and tabs keys for this purpose means that the user can not enter
multiple paragraphs into a cell, or use tab stops (if TextEdit has been modified).
Therefore, priority has to be given to one of the Managers. I have assumed that a cell
only contains a single line of text (a few words or a number), and therefore, we can
safely give these events to the List Manager. Moving from cell to cell with the cursor
keys should cause the entire text in the next cell to be selected.
Secondly, the user should still be allowed to make multiple selections from the
list by holding down the shift key. In this case, the first cell selected is editable, and
the cursor keys are restricted to moving to another cell in the range selected. These