emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a group as node of a tree widget


From: David PONCE
Subject: Re: a group as node of a tree widget
Date: Mon, 19 Sep 2005 10:27:54 +0200 (CEST)

Hi Masatake,

> Is it possible to use a group widget as node of tree widget?
> 
> As far as trying following code, a group widget is not handled well.

You're right.  Does it work better with this patch?

Thanks for your report.

David


2005-09-19  David Ponce  <address@hidden>

        * tree-widget.el (tree-widget-value-create): Save the converted
        tree :node widget.

Index: tree-widget.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tree-widget.el,v
retrieving revision 1.9
diff -c -r1.9 tree-widget.el
*** tree-widget.el      15 Aug 2005 13:00:09 -0000      1.9
--- tree-widget.el      19 Sep 2005 08:21:31 -0000
***************
*** 647,660 ****
            (when (and (not args) xpandr)
              (setq args (mapcar 'widget-convert (funcall xpandr tree)))
              (widget-put tree :args args))
            ;; Create the icon widget for the expanded tree.
            (push (widget-create-child-and-convert
!                  tree (widget-get tree (if args :open-icon :empty-icon))
!                  ;; At this point the node widget isn't yet created.
!                  :node (setq node (widget-convert node)))
                  buttons)
            ;; Create the tree node widget.
!           (push (widget-create-child tree node) children)
            ;; Update the icon :node with the created node widget.
            (widget-put (car buttons) :node (car children))
            ;; Create the tree children.
--- 647,661 ----
            (when (and (not args) xpandr)
              (setq args (mapcar 'widget-convert (funcall xpandr tree)))
              (widget-put tree :args args))
+           ;; Defer the node widget creation after icon creation.
+           (widget-put tree :node (widget-convert node))
            ;; Create the icon widget for the expanded tree.
            (push (widget-create-child-and-convert
!                  tree (widget-get tree (if args :open-icon :empty-icon)))
                  buttons)
            ;; Create the tree node widget.
!           (push (widget-create-child tree (widget-get tree :node))
!                 children)
            ;; Update the icon :node with the created node widget.
            (widget-put (car buttons) :node (car children))
            ;; Create the tree children.
***************
*** 696,709 ****
                ;; Update the icon :node with the created node widget.
                (widget-put (car buttons) :node (car children)))))
  ;;;; Collapsed node.
        ;; Create the icon widget for the collapsed tree.
        (push (widget-create-child-and-convert
!              tree (widget-get tree :close-icon)
!              ;; At this point the node widget isn't yet created.
!              :node (setq node (widget-convert node)))
              buttons)
        ;; Create the tree node widget.
!       (push (widget-create-child tree node) children)
        ;; Update the icon :node with the created node widget.
        (widget-put (car buttons) :node (car children)))
      ;; Save widget children and buttons.  The tree-widget :node child
--- 697,711 ----
                ;; Update the icon :node with the created node widget.
                (widget-put (car buttons) :node (car children)))))
  ;;;; Collapsed node.
+       ;; Defer the node widget creation after icon creation.
+       (widget-put tree :node (widget-convert node))
        ;; Create the icon widget for the collapsed tree.
        (push (widget-create-child-and-convert
!              tree (widget-get tree :close-icon))
              buttons)
        ;; Create the tree node widget.
!       (push (widget-create-child tree (widget-get tree :node))
!             children)
        ;; Update the icon :node with the created node widget.
        (widget-put (car buttons) :node (car children)))
      ;; Save widget children and buttons.  The tree-widget :node child






reply via email to

[Prev in Thread] Current Thread [Next in Thread]