All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

callbacks Class

Summary

The class callbacks is used as a mixin by classes that provide callbacks.

Package

capi

Superclasses

capi-object

Subclasses

collection
item
menu-object

Initargs
:callback-type
The type of arguments for the callbacks.
:selection-callback
The callback for selecting an item.
:extend-callback
The callback for extending the selection.
:retract-callback
The callback for deselecting an item.
:action-callback
The callback for an action.
:alternative-action-callback
The callback for an alternative action in choice and its subclasses.
Accessors

callbacks-callback-type
callbacks-selection-callback
callbacks-extend-callback
callbacks-retract-callback
callbacks-action-callback

Description

Each callback function can be one of the following:

function
Call the function.
list
Apply the head of the list to the tail.
:redisplay-interface

Call redisplay-interface on the top-level interface.

:redisplay-menu-bar

Call redisplay-menu-bar on the top-level interface.

The slot value callback-type determines which arguments get passed to each of the callbacks. It can be any of the following values, and passes the corresponding data to the callback function:

:collection-data
(collection data)
:data
(item-data)
:data-element
(item-data element)
:data-interface
(item-data interface)
:element
(element)
:element-data
(element item-data)
:element-item
(element item)
:interface-data
(interface item-data)
:item
(item)
:item-element
(item element)
:item-interface
(item interface)
:interface-item
(interface item)
:interface
(interface)
:full
(item-data item interface)
:focus
The pane with the current input focus.
:none
()

callback-type can also be a list containing any of :focus, :data, :element, :interface, :collection, :item.

The item-data variable is the item's data if the item is of type item, otherwise it is the item itself, as for item. The item variable means the item itself. The interface is the element-interface of the element. collection is the element's collection, if there is one. The element variable means the element containing the callback itself.

When looking for a callback function and callback-type in an object of type item, menu-item or toolbar-button, LispWorks uses the corresponding value from the object if it is non-nil and otherwise looks for a non-nil value in its ancestor objects (up to the menu, toolbar or the item's collection). That allows you specify a callback and type in a collection, menu, menu-component, toolbar or toolbar-component to be used for all its children. For an example, see the mmm interface in the documentation for menu-item.

If no non-nil callback-type is found then :data-interface is used unless documented differently by the class (for example text-input-range).

In a choice, the alternative-action-callback is invoked by a gesture which is the action-callback gesture modified by the Shift key on Microsoft Windows and GTK+, and modified by the Command key on Cocoa.

alternative-action-callback is applicable only to choice and its subclasses.

Apart from being invoked with a different gesture, the alternative-action-callback has exactly the same semantics as action-callback.

Examples
(example-edit-file "capi/choice/alternative-action-callback")
See also

abort-callback
choice
attach-interface-for-callback
3.4 Callbacks
5.10.3 Callbacks in choices
8 Creating Menus


CAPI User Guide and Reference Manual (Macintosh version) - 18 Feb 2025 15:33:09