TAdvTreeView - Iterate thru all Nodes

Hi,


i want to iterate thru all nodes in a tadvtreeview but i only get the root nodes. What should i do to get all nodes like in a normal treeview ?

Regards,

Andy

Hi, 


We would very much like to see the code you are using to retrieve the nodes to see if there is anything missing?

Pieter Scheldeman2016-03-21 15:42:26

Hello Pieter,


of course ... here it is ... 

 tvAnalysis.BeginUpdate(false);
 for i := 0 to tvAnalysis.Nodes.Count - 1 do
 begin
  tvAnalysis.Nodes.Text[0] := GetTranslatedStringForNode(TvAnalysis.Nodes);
 end;
 tvAnalysis.EndUpdate;

Regards,

Andy

Hi, 


With this code it is normal that only the first level of nodes are accessed. Each Node itself has a Nodes collection:

tvAnalysis.Nodes[0].Nodes -> second level of nodes

So i have to iterate thru it recursivly ?

Correct, or you can use the functions already available in the treeview:


var
  n: TAdvTreeViewNode;
begin
  n := AdvTreeView1.GetFirstRootNode;
  while Assigned(n) do
  begin
    n.Text[0] := 'Hello';
    n := n.GetNext;
  end;

Pieter


thanks a lot ... thats exactly that what i was looking for

Have a nice evening and happy eastern.

Greets from germany,

Andy