Class
choice is an abstract class that collects together a group of items, and provides functionality for displaying and selecting them. choice-selection
choice-selected-item
choice-selected-items
choice-interaction
choice inherits most of its behavior fromcollection, and then provides the selection facilities itself. The classes list-panel, button-panel, menu-component and graph-pane inherit from it, and so it plays a key role in CAPI applications. choice can have one of four different interactions, and these control how it behaves when an item is selected by the user. no-selection mode, the choice cannot have a selection, and so behaves just as a collection would. single-selection mode, the choice can only have one item selected at a time. When a new selection is made, the old selection is cleared and theselection-callback is called. multiple-selection mode, the choice can have any number of items selected, and selecting an item toggles its selection status. Theselection-callback is called when an item becomes selected, and theretract-callback is called when an item is deselected. extended-selection mode, the choice can have any number of items selected as withmultiple-selection mode, but the usual selection gesture removes the old selection. However, there is a window system specific means of extending the selection. When an item is selected theselection callback is called, when the selection is extended theextend-callback is called, and when an item is deselected theretract-callback is called. choice-selected-item andchoice-selected-items treat the selection in terms of the items themselves as opposed to their indices. (setf collection-items) the selection is lost. keep-selection-p set tot, then the selection is preserved over the change.
(setq choice (make-instance 'capi:choice
:items '("One" "Two" "Three")
:selection 0))
(capi:display-message "Selection: ~S"
(capi:choice-selection choice))
(capi:choice-selected-item choice)
(setf (capi:choice-selection choice) 1) (capi:choice-selected-item choice)