NextPrevUpTopContentsIndex

19.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 and click OK .
  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. Now set the following attributes of the list panel. Click OK when done.
  9. 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. Select the Graph graph pane and display its Attributes dialog.
  11. 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.

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

  14. Set the READER attribute to graph-reader .
  15. Before you set the next callback, evaluate this form:
  16. (defun children-function (x)
      (when (< x 8)
        (list (* x 2) (1+ (* x 2)))))

    Now 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. It is called when displaying the prototype interface, so it is best to define it before setting this attribute.

  17. Click OK to dismiss the Attributes dialog..

Common LispWorks User Guide (Windows version) - 5 Jul 2006

NextPrevUpTopContentsIndex