4.6 General properties of choices
The following callbacks are available::selection-callback
,:retract-callback
(called when a deselection is made),:extend-callback
, and:action-callback
(called when a double-click occurs). What makes one choice different from another is that they permit different combinations of these callbacks. This is a consequence of the differing interactions. For example, you cannot have an:extend-callback
in a radio button panel, because you cannot extend selection in one.
Callbacks pass data to the function they call. There are default arguments for each type of callback. Using the:callback-type
keyword allows you to change these defaults. It can take any of the following arguments.
:interface
:data
:item
:interface-data
,:interface-item
,:data-interface
and:item-interface
. In each of these cases two arguments are passed to the callback function. A final option is to pass no arguments, using the:none
keyword The following example uses a push button and a callback function to display the arguments it receives.
(defun show-callback-args (arg1 arg2) (display-message "The arguments were ~S and ~S" arg1 arg2))Try changing the(setq example-button (make-instance 'push-button :text "Push Me" :callback 'show-callback-args :data "Here is some data" :callback-type :data-interface))
(contain example-button)
:callback-type
to other types. If you do not use the:callback-type
argument and you do not know what the default is, you can include a&rest
args
statement in your callback function to account for all the arguments that might be passed.
Specifying a callback that is invalid for a particular choice causes a compilation error.
Generated with Harlequin WebMaker