CLIM mail archive


Re: updating-output and recursive use of formatting-graph-from-root


In your example:

	Lost in helplessness - Stefan B.

	;;;What follows is the display method for the tree-pane:

	(defmethod draw-tree-as-tree ((frame tree1) stream)
	  (let ((tree (tree1-tree frame)))
	      ((draw-subtree (subtree stream)
		 (let* ((inferior-producer #'(lambda (node)
				       ;; just return the direct inferiors
				       (and (eql node subtree) 
					    (tree-node-expanded node)
					    (tree-node-children node)))))
		   (updating-output (stream
			      :unique-id subtree
			      :cache-value (tree-node-tick-mark subtree)
			      :cache-test #'=)
		     (with-output-as-presentation (:stream stream
						   :object subtree
						   :type 'tree)
		       (cond ((and (tree-node-children subtree)
				   (tree-node-expanded subtree))
			; we have to draw a tree
				  #'(lambda (node stream)
				      (if (eql node subtree)
					  (format stream "~A"
						; draw root node
						  (tree-node-value node))
					  (draw-subtree node stream)))
						; draw sons as trees
				  :stream stream))
			       (t ; we have to draw a leaf
			(format stream "~A" (tree-node-value subtree)))))))))
	      (draw-subtree tree stream))))

It looks like you're trying to call format-graph-from-root
recursively, which I don't believe you want.  In effect, you are
giving format-graph-from-root the form to create a whole subtree where
it only wants the form to draw one node of the tree.  I think you may
accomplish what you want by giving a single-node drawing form to
f-g-f-r as the printer, with that form including an updating-output
and an output-record producing form (like a presentation).  Your code
is trying to draw the tree itself, which frmat-.. already does.

Or, I could be totally off on this.

Follow-Ups: References:

Main Index | Thread Index