Lisp HUG Maillist Archive

tracking expanded tree-view nodes

     I'm displaying a big semantic network using tree-view.
After updating that network,  the tree-view has to be
repainted by retaining expansion for expanded nodes currently
expanded by hand-gestures.

    To record currently these expanded nodes,  I'm traversing
capi:collection-items to call capi:tree-view-expanded-p.
This works as long as the print-function prints out
the node names unchanged.  But when print-function displays
strings different from underlying unique nodes names fed to
the children-function,  tree-view-expanded-p can't
find the node names.

    Is there any way to get a list of expanded nodes
in terms of their underlying children-function names?
For a big network retention of expanded nodes is important.

-- Lawrence


Re: tracking expanded tree-view nodes

Hello Lawrence,

|      I'm displaying a big semantic network using tree-view.
| After updating that network,  the tree-view has to be
| repainted by retaining expansion for expanded nodes currently
| expanded by hand-gestures.
|
|     To record currently these expanded nodes,  I'm traversing
| capi:collection-items to call capi:tree-view-expanded-p.
| This works as long as the print-function prints out
| the node names unchanged.  But when print-function displays
| strings different from underlying unique nodes names fed to
| the children-function,  tree-view-expanded-p can't
| find the node names.
|
|     Is there any way to get a list of expanded nodes
| in terms of their underlying children-function names?
| For a big network retention of expanded nodes is important.

Have you supplied the test-function? Personally, I would not recommend using
strings as tree-view items, but "more meaningful" atoms accompanied by a
print-function instead.

BTW, it would be nice having the default test-function for various capi:collection
subclasses documented :-(.
--
Sincerely,
Dmitri Ivanov
lisp.ystok.ru


Re: tracking expanded tree-view nodes

Hello Dmitri,
     Thanks for your suggestion,  it really helped.
I changed the children-function to use unique integers
to identify nodes and children.  I also coded a complete breadth-first 
scan
of expanded children to track expanded nodes.  Everything
works now,  and runs a lot faster too.

    I also think it would be VERY nice to have the effect of the default 
test-function
documented.

Lawrence

On Thursday, June 17, 2004, at 01:42 AM, Dmitri Ivanov wrote:

> Hello Lawrence,
>
> |      I'm displaying a big semantic network using tree-view.
> | After updating that network,  the tree-view has to be
> | repainted by retaining expansion for expanded nodes currently
> | expanded by hand-gestures.
> |
> |     To record currently these expanded nodes,  I'm traversing
> | capi:collection-items to call capi:tree-view-expanded-p.
> | This works as long as the print-function prints out
> | the node names unchanged.  But when print-function displays
> | strings different from underlying unique nodes names fed to
> | the children-function,  tree-view-expanded-p can't
> | find the node names.
> |
> |     Is there any way to get a list of expanded nodes
> | in terms of their underlying children-function names?
> | For a big network retention of expanded nodes is important.
>
> Have you supplied the test-function? Personally, I would not recommend 
> using
> strings as tree-view items, but "more meaningful" atoms accompanied by 
> a
> print-function instead.
>
> BTW, it would be nice having the default test-function for various 
> capi:collection
> subclasses documented :-(.
> --
> Sincerely,
> Dmitri Ivanov
> lisp.ystok.ru
>


Weird capi:tree-view-update-an-item

Hello lispworkers,

Consider the following piece of code:

(defvar *light* t)
(capi:define-interface my-tree ()
  ()
  (:panes
   (tree capi:tree-view
    :roots '(:red :blue :green)
    :children-function
     (lambda (item)
       (when (eq item :blue)
         (cons :dark-blue (if *light*
                              '(:light-blue)
                              nil))))
    :print-function 'string-capitalize))
  (:default-initargs :width 200 :height 200))

(setq my-tree (capi:contain (make-instance 'my-tree))
      tv (slot-value my-tree 'tree))

(setq *light* (not *light*))    ; switch the light

Now, I want to update the tree-vew:

(capi:execute-with-interface my-tree
  'capi:tree-view-update-an-item tv :light-blue t)

=> gives the wrong picture with the Blue root replace by Light-Blue. Next call:

(capi:execute-with-interface my-tree
  'capi:tree-view-update-an-item tv :blue nil)

=> restores the correct view.

The same occurs after switching the *light* again.

What am I doing wrong? Do I always need calling capi:tree-view-update-an-item
twice when adding or removing items?
--
Sincerely,
Dmitri Ivanov
lisp.ystok.ru


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