
13 The List Widget
This chapter describes another control that the user can manipulate. The List widget displays a number of text choices
that the user can select interactively.
Almost every application needs to display lists of choices to the user. This task can be accomplished in many ways,
depending on the nature of the choices. For example, a group of ToggleButtons is ideal for displaying configuration
settings that can be individually set and unset and then applied all at once. A list of commands can be displayed in a
PopupMenu, or for a more permanent command palette, a RowColumn or Form widget can manage a group of
PushButton widgets. But for displaying a list of text choices, such as a list of files to be opened or a list of fonts to be
applied to text, nothing beats a List widget.
A List widget displays a single column of text choices that can be selected or deselected using either the mouse or the
keyboard. Each choice is represented by a single−line text element specified as a compound string. the figure shows a
typical List widget.
A List widget with two selected items
Internally, the List widget operates on an array of compound strings that are defined by the application. (See
Chapter 19, Compound Strings, for a discussion of how to create and manage compound strings.) Compound strings
that use multiple fonts are allowed, but the List widget does not render these items very well. ...