Re: Count all nodes in a treeview

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Pete,

the above statement, you want to iterate the nodes in some specific
order. Do you literally need a counter that is assigned to each node
in order? Or are you simply looking for a specific order of
enumeration?

When I wrote my function to save and load the tree, I wrote it using
the
ItemIndex of the nodes in the tree. In CBuilder the nodes will go from
1-?? however many you have in the tree when doing the recursion.
Even if the nodes are nested 10 deep the numbers will still go in
order.

// in c# the numbers will be like this as you pointed out
Parent Node: 0
Child Node: 0
Parent Node: 1
Child Node: 1
Parent Node: 2
Child Node: 2

// in cbuilder the numbers will be like this
Parent Node: 1
Child Node: 2
Parent Node: 3
Child Node: 4
Parent Node: 5
Child Node: 6


I don't see anything in the code C++Builder code you posted that
would help me understand how you're currently reconstituting the
tree based on

Not yet, I was just posting the storing of the tree to get it to work.
Rebuilding
the tree would be a lot more difficult. I didn't attempt that one
yet.

As near as I can tell from what you've posted, C++Builder has hidden
some (most? all?) of the recursive nature of your data structure
from you, handling that all behind the scenes. Which I suppose is
fine for a specific purpose, but it seems to have put you at a
disadvantage with

Absolutely right, C++Builder keeps a lot of items behind the scenes so
you
can write code faster. As a matter of fact, I just found out the
other day from
a friend who codes in Delphi and has been using C# for quite a while.
He told
me that the same person who wrote Delphi wrote C#. I kinda wondered
how come
the syntax is so close, and the IDE looks almost the same in Delphi,
C++Builder, and
C#.

C# also hides a lot of the behind the scenes options when using the
extensive library
called the toolbox. This makes developing a lot easier and faster for
the developer.

Thanks again for you help Pete.


John


.



Relevant Pages

  • Re: Cantor and the binary tree
    ... >>> is, and if one is infinite, so is the other. ... Finite paths in a tree consist of finitely many nodes and finitely many ... each parent node to each of its child nodes by a branch. ... one child node but a child node cannot have more than one parent node. ...
    (sci.math)
  • Drag and Drop in a Tree view
    ... I want to drag items from a List box to a tree view. ... parent node but not a child node. ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Drag and drop into a Tree View
    ... I want to drag items from a List box to a tree view. ... parent node but not a child node. ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: Row of parent of Node in JTree
    ... > Jim Sculley wrote: ... > saves information about the structure of the tree in an XML file for later ... > parent node of said node so that when I reconstruct the tree I have the ... An XML document already ...
    (comp.lang.java.help)
  • Re: [GIT PULL] PM updates for 2.6.33
    ... classic depth-first or depth-last tree algorithm. ... I did that because that clarifies the locking rules (ie "we traverse ... There's no stall in the thing, ... the parent " on the parent node ...
    (Linux-Kernel)