15.6 Defining the callbacks

15.6.3 Callbacks for menu items

Both menu items in the interface need a callback function. As with other callback functions, these are specified by defining a general callback,display-pane-selection, which displays, in a dialog, the current selection of any pane.

(defun display-pane-selection (reader data interface)
  (declare (ignore data))
  (capi:display-message "~S: ~S selected"
                        (capi:capi-object-name 
                         (funcall reader interface)) 
                        (capi:choice-selected-items 
                         (funcall reader interface))))

The following two functions calldisplay-pane-selection, passing the reader of a pane as an argument. These functions are specified as the callbacks for the two menu items.

(defun display-graph-selection (&rest args)
  (apply 'display-pane-selection 'graph-reader args))

(defun display-list-selection (&rest args) (apply 'display-pane-selection 'list-reader args))

As with the other callback functions, specifying the callbacks in this way allows for easy extension of the example.


Common LispWorks User Guide, Liquid Common Lisp Version 5.0 - 18 OCT 1996

Generated with Harlequin WebMaker