unit Utreeform;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, ugentree,
Vcl.StdCtrls;
type
TForm2 =
class(TForm)
Memo1: TMemo;
lblComponents: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
Root: TNode;
myFirstNode: TNode;
mySecondNode: TNode;
MyThirdNode: TNode;
implementation
{$R *.dfm}
procedure CreateNodes;
var Data: TNodeData; Node: TNode;
begin
Node := TNode.Create(CompareStr);
Data := TNodeData.Create(0,'
TButton',
nil,Node);
Data.KeyStr := '
TButton';
Root.AddSubnode(TNode.Create(CompareStr),Data);
Node := TNode.Create(CompareStr);
Data := TNodeData.Create(0,'
TEdit',
nil,Node);
Data.KeyStr := '
TEdit';
Root.AddSubnode(TNode.Create(CompareStr),Data);
Node := TNode.Create(CompareStr);
Data := TNodeData.Create(0,'
TGrid',
nil,Node);
Data.KeyStr := '
TGrid';
Root.AddSubnode(TNode.Create(CompareStr),Data);
end;
procedure TForm2.FormCreate(Sender: TObject);
var i: Integer; D: TNodeData;
begin
CreateNodes;
for i := 0
to Root.Count-1
do
begin
D := Root.Nodes[i].Data;
Memo1.Lines.Add(D.KeyStr);
end;
end;
initialization
Root := TNode.Create(CompareStr);
finalization
end.