[gtkada] Ctree Collapse-Expand and resultant node list

Wells, Larisa lwells at dcscorp.com
Wed Mar 21 03:51:45 CET 2001


There is no problem with Gtk.Ctree.Is_Visible -- I should have used set the
parameter "After => true" in my callback connect so that I would not be
querying a stale state of a node.  

However, the node_list part of the original message is still a problem since
the expansion state of the tree should not have an impact on the contents of
the node_list itself, I believe.  

Larisa

-----Original Message-----
From: Wells, Larisa 
Sent: Tuesday, March 20, 2001 5:15 PM
To: 'gtkada at gtkada.eu.org'
Subject: RE: [gtkada] Ctree Collapse-Expand and resultant node list


I managed a work-around, but it's a convoluted one and has limitations.

After filling the tree, I assembled a node list using my own list utility.
I then used this list, instead of the query Gtk.Ctree.Get_Node_List, when
attempting to determine if each node is viewable.  So the fact that the
Gtk.Ctree.Node_List was dropping nodes, did not mean that the nodes
themselves were corrupt.

This local list works in my case because my tree is static.  If you are
adding and deleting nodes from the tree after the user has access to expand
and collapse, then managing the "extra" list becomes more of a chore.

The second problem is still a strange one.  Replacing the use of
Gtk.Ctree.Is_Viewable with the following seems to work:

   function New_Is_Viewable 
     (Ctree : Gtk.Ctree.Gtk_Ctree; Node : Gtk.Ctree.Gtk_Ctree_Node)
   return Boolean is
   
   begin
       return not Gtk.Ctree.Is_Viewable
            (Ctree => Ctree,
             Node  => Node) or else
           Gtk.Ctree.Row_Get_Parent 
              (Row => Gtk.Ctree.Node_Get_Row (Node => Node))
           = Gtk.Ctree.Null_Ctree_Node;
   end New_Is_Viewable;

So the Gtk.Ctree.Is_Viewable logic seems reversed for all except for the
nodes of depth 0, where it is always viewable.

That wouldn't be all so bad, except that the first time the tree is shown
(expanded), the Gtk.Ctree.Is_Viewable (rightly) returns true for all
nodes,instead of a reversal of logic for child nodes.  So I had to add a
"first time" attribute to check (and I must always initialize with the tree
expanded -- no problem for me, but a limitation).

Hope this helps,
-Larisa


-----Original Message-----
From: Wells, Larisa 
Sent: Tuesday, March 20, 2001 11:23 AM
To: GtkAda Mailing List (E-mail)
Subject: [gtkada] Ctree Collapse-Expand and resultant node list


I am attempting to obtain the node_list from a ctree with 4 items (maximum
depth 3), and then use that list to determine if each item "Is_Viewable".  I
am experiencing two problems:

   1) After expanding and collapsing the branch once (it is initialized
expanded), the node list contents changes (as queried by Get_Node_List).
Oddly, it drops the items that are in the expanded branch, then picks them
up again when it is collapsed.  The list count continues to toggle back and
forth indefinitely with the collapse and expansion.  I would expect that the
list should not change regardless of the expansion state, but I certainly
wouldn't expect items to be omitted from the list when they are viewable.

   2) When performing the Is_Viewable query on each of these node from the
list, it always returns true.  I then tried to build my own Is_Viewable
query using Row_Get_Expanded, and it too always returns true for each node
in the list.

Has anyone encountered either of these problems, or could suggest a work
around?

Thank you!
Larisa

_______________________________________________
gtkada mailing list
gtkada at gtkada.eu.org
http://gtkada.eu.org/mailman/listinfo/gtkada

_______________________________________________
gtkada mailing list
gtkada at gtkada.eu.org
http://gtkada.eu.org/mailman/listinfo/gtkada




More information about the gtkada mailing list