Lisp HUG Maillist Archive

How to re-layout a graph-pane?

If you have a graph-pane and alter one of the nodes, say making it
longer or shorter, how do you get it and its children to redraw
correctly?  The only thing I've gotten to work is

 (map-pane-children *graph-pane*
                    (lambda (item)
                       (update-pinboard-object item)))

which seems suboptimal.

I'm doing something akin to this:

(defparameter *root* (list 1))
(defparameter *child1* (list 2))
(defparameter *child2* (list 3))
(defparameter *graph-pane*
  (make-instance 'graph-pane
                 :roots (list *root*)
                 :children-function (lambda (item)
                                      (when (eql item *root*)
                                        (list *child1* *child2*)))))
(contain *graph-pane*)
(setf (car *root*) 1111111111111)

; I'm pretty sure everything above here is okay.  It's everything below that
; seems questionable.

(let* ((graph-node (find-graph-node *graph-pane* *root*))
       (pinboard-object (graph-object-element graph-node)))
  (setf (item-text pinboard-object) (format nil "~A" *root*)))
(map-pane-children *graph-pane*
                   (lambda (item)
                     (update-pinboard-object item)))

I'm also worried that this might work only accidentally and might
depend on the order of children traversed by map-pane-children.

-- L


Updated at: 2020-12-10 08:42 UTC