All Manuals > CAPI Reference Manual > 1 CAPI Reference Entries

NextPrevUpTopContentsIndex

item

Class
Summary

The class item groups together a title, some data and some callbacks into a single object for use in collections and choices.

Package

capi

Superclasses

callbacks
capi-object

Subclasses

menu-item
button
item-pinboard-object
popup-menu-button
toolbar-button

Initargs

:collection

The collection in which item is displayed

:data

The data associated with the item.

:text

The text to appear in the item (or nil ).

:print-function

If text is nil, this is called to print the data.

:selected

If t the item is selected.

Accessors

item-collection
item-data
item-text
item-print-function
item-selected

Description

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.

Example
(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))
See also

itemp
collection
choice
print-collection-item


CAPI Reference Manual - 15 Dec 2011

NextPrevUpTopContentsIndex