Next Prev Up Top Contents Index

14.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, click the Layouts tab at the top of the interface builder to display the layouts view.
  2. Select the Selection-Text display pane and display the Attributes dialog.
  3. Set the READER attribute to selection-reader .
  4. 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.

  5. Select the List list panel and display its Attributes dialog.
  6. Set the READER attribute to list-reader . Do not click OK yet.
  7. 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 (make sure you click the "Callbacks" tab):

    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.

  8. If you have not already done so, click Options , and ensure that Callbacks is selected in the Attributes to View dialog and click OK .
  9. Now set the following attributes of the list panel. Click OK when done.
  10. 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

  11. Select the Graph graph pane and display its Attributes dialog.
  12. 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.

  13. Set the following attributes of the graph pane.
  14. 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

  15. Set the READER attribute to graph-reader .
  16. Set the CHILDREN-FUNCTION attribute to 'children-function .
  17. The children function defines what is drawn in the graph, and so is vital for any graph pane.

  18. Set the NODES-CONTRACTABLE-P attribute to nil .
  19. 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).

  20. 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 - 14 Dec 2001

Next Prev Up Top Contents Index