
9.3 Creating graphical objects
Create the following graph-pane and notice that every node in the graph is made from anitem-pinboard-object as described in the previous section and that each edge is made from aline-pinboard-object.
(defun node-children (node)
(when (< node 16)
(list (* node 2)
(1+ (* node 2)))))
(contain
(make-instance
'graph-pane
:roots '(1)
:children-function 'node-children)
:best-width 300 :best-height 400)

Figure 9.5 A graph pane with pinboard object nodes
As mentioned before, pinboard-layouts can just as easily display ordinary panes inside themselves, and so the graph-pane provides the ability to specify the class used to represent the nodes. As an example, here is a graph-pane with the nodes made from push-buttons.
(contain (make-instance 'graph-pane :roots '(1) :children-function 'node-children :node-pinboard-class 'push-button) :best-width 300 :best-height 400)

Figure 9.6 A graph pane with push-button nodes

Generated with Harlequin WebMaker