Author: Yovanny Rodriguez
TTreeView easy way to add item
Answer:
Here is a simple procedure that add Item in TreeView component classed by level ...
usefull for a "debug" ttreeview
1 {Add in the Public declaration}2 3 DebugNode: array[0..9] of TTreeNode;
4 5 procedure AddDebug(Level: Integer; Text: string);
6 7 {Add between Implementation and End.}8 9 procedure TForm1.AddDebug(Level: Integer; Text: string);
10 begin11 if Level = 0 then12 DebugNode[0] := TreeView1.Items.Add(nil, Text)
13 else14 DebugNode[Level] := TreeView1.Items.AddChild(DebugNode[Level - 1], Text);
15 end;