15.4 Specifying callbacks in the interface definition
15.4.1 Specifying layout callbacks and other callback information
This section shows you how to specify all the callbacks necessary for each element in the example interface, together with other attributes that are required for correct operation of the callback functions. You need to specify attribute values for the display pane, the list panel and the graph pane.
- 1. If necessary, choose View > Layouts to display the layouts view.
- For the display pane, you only need to specify one attribute.
- 2. Select the
Selection-Text
display pane and display the Attributes dialog.
- 3. Set the READER attribute to
selection-reader
.
- This reader allows the display pane to be identified by the callback code.
- For the list panel, you need to specify four callbacks and a reader.
- 4. Select the
List
list panel and display its Attributes dialog.
- 5. Set the READER attribute to
list-reader
. Do not click OK yet.
- Like the display pane, this reader is necessary so that the list panel can be identified by the callback code.
Next, you need to specify the following four types of callback:- Selection callback. The function that is called when you select a list item.
- Extend callback. The function that is called when you extend the current selection.
- Retract callback. The function that is called when you deselect a list item.
- Action callback. The function that is called when you double-click on a list item.
Callbacks attributes are not currently visible in the Attributes dialog, so you must display them first.
- 6. Click Options, and ensure that Callbacks is selected in the Attributes to View dialog and click OK.
- 7. Now set the following attributes of the list panel. Click OK when done.
- SELECTION-CALLBACK to
'update-selection-select
EXTEND-CALLBACK to'update-selection-extend
RETRACT-CALLBACK to'update-selection-retract
ACTION-CALLBACK to'display-selection-in-dialog
- 8. Select the
Graph
graph pane and display its Attributes dialog.
- For the graph pane, you need to set the same four callbacks, as well as a reader, and two other attributes that are important for the callback code to run correctly.
- 9. Set the following attributes of the graph pane.
- SELECTION-CALLBACK to
'update-selection-select
EXTEND-CALLBACK to'update-selection-extend
RETRACT-CALLBACK to'update-selection-retract
ACTION-CALLBACK to'display-selection-in-dialog
- 10. Set the READER attribute to
graph-reader
.
- 11. Set the CHILDREN-FUNCTION attribute to
'children-function
.
- The children function defines what is drawn in the graph, and so is vital for any graph pane.
- 12. Set the NODES-CONTRACTABLE-P attribute to
nil
.
- Normally, double-clicking on a graph node expands or collapses the node, as appropriate. In this example, the action callback calls a different function explicitly. To ensure that this function is always called, you must inhibit the normal graph behavior by setting this attribute to
nil
. If you do not do this, then the action callback you have specified is only called on nodes which cannot be expanded or contracted (that is, leaf nodes).
- 13. Click OK to dismiss the Attributes dialog.
Note: The graph pane no longer displays a graph. This is because you have specified a children function which is not yet defined in the environment. You may also find that a notifier appears, informing you that the function is not defined. Click Abort to remove the notifier.
Common LispWorks User Guide, Liquid Common Lisp Version 5.0 - 18 OCT 1996 Generated with Harlequin WebMaker