The class
item
groups together a title, some data and some callbacks into a single object for use in collections and choices.
The collection in which item is displayed
The data associated with the item.
The text to appear in the item (or
nil
).
If text is nil, this is called to print the data.
If
t
the item is selected.
An item can provide its own callbacks to override those specified in its enclosing collection , and can also provide some data to get passed to those callbacks.
An item is printed in the collection by print-collection-item. By default this returns a string using item 's text if specified, or else calls a print function on the item's data . The print-function will either be the one specified in the item, or else the print-function for its parent collection.
The
selected
slot in an item is non-nil if the item is currently selected. The accessor
item-selected
is provided to access and to set this value.
(defun main-callback (data interface)
(capi:display-message "Main callback: ~S"
data))
(defun item-callback (data interface)
(capi:display-message "Item callback: ~S"
data))
(capi:contain (make-instance
'capi:list-panel
:items (list
(make-instance
'capi:item
:text "Item"
:data '(some data)
:selection-callback
'item-callback)
"Non-Item 1"
"Non-Item 2")
:selection-callback 'main-callback))