All Manuals > CAPI User Guide and Reference Manual

NextPrevTopContentsIndex

5 Choices - panes with items

Some elements of a window interface contain collections of items, for example rows of buttons, lists of filenames, and groups of menu items. Such elements are known in the CAPI as collections .

In most collections, items may be selected by the user — for example, a row of buttons. Collections whose items can be selected are known as choices . Each button in a row of buttons is either checked or unchecked, showing something about the application's state — perhaps that color graphics are switched on and sound is switched off. This selection state came about as the result of a choice the user made when running the application, or default choices made by the application itself.

The CAPI provides a convenient way of producing groups of items from which collections and choices can be made. The abstract class collection provides a means of specifying a group of items. The subclass choice provides groups of selectable items, where you may specify what initial state they are in, and what happens when the selection is changed. Subclasses of collection and choice used for producing particular kinds of grouped elements are described in the sections that follow.

All the choices described in this chapter can be given a print function via the :print-function keyword. This allows you to control the way in which items in the element are displayed. For example, passing the argument 'string-capitalize to :print-function would capitalize the initial letters of all the words of text that an instance of a choice displays.

Collections and choices inherit from the abstract class callbacks, which defines callbacks that are called in response to user gestures.

Some of the examples in this chapter require the callback function test-callback and hello which were introduced in General Properties of CAPI Panes.

5.1 Items

5.2 Button panel classes

5.3 List panels

5.4 Trees

5.5 Graph panes

5.6 Option panes

5.7 Text input choice

5.8 Menu components

5.9 General properties of choices

5.10 Operations on collections (choices) and their items


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015

NextPrevTopContentsIndex