5.5 Advanced Pane Layouts
(make-instance 'tab-layout :items (list (list "one" red-pane) (list "two" green-pane) (list "three" blue-pane)) :print-function 'car :visible-child-function 'second)The example needs the(contain *)
:print-function
to becar
, or else the tabs will be labelled with the object numbers of the panes as well as the title provided in the list. However, a tab layout can also be used in a non-switchable manner, with each tab responding with a callback to alter the appearance of only one pane. In this mode the:description
keyword is used to describe the main layout of the tab pane. In the following example the tabs alter the choice of starting node for one graph pane, by using a callback to thegraph-pane-roots
accessor:
(defun tab-graph (items) (let* ((gp (make-instance 'graph-pane)) (tl (make-instance 'tab-layout :description (list gp) :items items :visible-child-function nil :key-function nil :print-function (lambda (x) (format nil "~R" x)) :callback-type :data :selection-callback #'(lambda (data) (setf (graph-pane-roots gp) (list data)))))) (contain tl)))(tab-graph '(1 2 4 5 7))
Generated with Harlequin WebMaker