2005. december 25., vasárnap

TTreeView easy way to add item

Problem/Question/Abstract:

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
}

{Add in the Public declaration}

DebugNode : Array [ 0..9 ] Of TTreeNode;
Procedure AddDebug ( Level : Integer; Text : String );

{Add between Implementation and End.}

Procedure TForm1.AddDebug ( Level : Integer; Text : String );
Begin
If Level = 0 Then
DebugNode [ 0 ] := TreeView1.Items.Add ( Nil, Text )
Else
DebugNode [ Level ] := TreeView1.Items.AddChild ( DebugNode [ Level - 1 ], Text );
End;


Nincsenek megjegyzések:

Megjegyzés küldése