source: trunk/Packages/CoolDocking/Demo/Testing/UComponentTree.pas

Last change on this file was 73, checked in by chronos, 12 years ago
  • Modified: Packages are now stored as uncomporessed and are linked with relative path to project.
File size: 1.2 KB
Line 
1unit UComponentTree;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
9 ComCtrls;
10
11type
12
13 { TComponentTree }
14
15 TComponentTree = class(TForm)
16 TreeView1: TTreeView;
17 procedure FormShow(Sender: TObject);
18 private
19 { private declarations }
20 public
21 procedure ReloadNode(Node: TTreeNode; Component: TComponent);
22 procedure Reload;
23 end;
24
25var
26 ComponentTree: TComponentTree;
27
28implementation
29
30uses
31 UMainForm;
32
33{ TComponentTree }
34
35procedure TComponentTree.FormShow(Sender: TObject);
36begin
37 Reload;
38end;
39
40procedure TComponentTree.ReloadNode(Node: TTreeNode; Component: TComponent);
41var
42 I: Integer;
43 NewNode: TTreeNode;
44begin
45 NewNode := Node.TreeNodes.AddChild(Node, Component.Name + ': ' + Component.ClassName);
46 for I := 0 to Component.ComponentCount - 1 do
47 ReloadNode(NewNode, Component.Components[I]);
48end;
49
50procedure TComponentTree.Reload;
51begin
52 with TreeView1, Items do begin
53 BeginUpdate;
54 Clear;
55 AddChild(nil, 'Root');
56 ReloadNode(TopItem, Application);
57 TopItem.Expand(True);
58 EndUpdate;
59 end;
60end;
61
62initialization
63 {$I UComponentTree.lrs}
64
65end.
66
Note: See TracBrowser for help on using the repository browser.