Chapter 14. ListBoxes

The ListBox class is a built-in control that maintains a columnar display of brief, individual lines of text—a list. The user can navigate the list and can select a line (or, optionally, more than one line simultaneously), using the mouse or keyboard.

Navigation keys are the up and down arrow keys and the Home, End, Page Up, and Page Down keys. If the user is permitted to select more than one line simultaneously, then Shift-clicking or Shift-up/down arrow selects a range of lines, and Command-clicking selects separate individual lines.

In the Tools Window, the ListBox is represented by two icons; the difference, which is purely a matter of convenience, has merely to do with the ListBox’s initial settings in the IDE—either two columns with headings, or one column with no heading.

ListBox Features

Each line of a ListBox is called a row . A ListBox also has at least one column. The intersection of a row and a column is an individual text item, and is called a cell.

Text in a ListBox has only one font and size. Individual cells, however, can receive their own bold, italic, and underline styling. A row may also include a picture (but the row does not expand to display it—in other words, a ListBox is not intended for display of pictures, but small pictures can be used to enhance a ListBox). Figure 14-1 shows a single-column and a multicolumn ListBox; in the multicolumn ListBox, the cells of the first column are bold, and each row includes a fruity picture.

Figure 14-1. Single-column ...

Get REALBasic: TDG, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.