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
:print-function would capitalize the initial letters of all the words of text that an instance of a choice displays. The default is
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
hello which were introduced in General Properties of CAPI Panes.
CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017