unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
VirtualTrees, StdCtrls, ExtCtrls, jpeg, Tabs;
type
TMainForm =
class(TForm)
TabSet1 : TTabSet;
ListBox1: TListBox;
Button1 : TButton;
Button2 : TButton;
Edit1 : TEdit;
VST : TVirtualStringTree;
procedure Button1Click(Sender: TObject);
private
//
public
{ Public declarations }
end;
var
Form1: TMainForm;
implementation
{$R *.dfm}
type
PTreeData = ^TTreeData;
TTreeData =
record
FCaption:
String;
FColumn1:
String;
end;
function AddVSTStructure(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;
ARecord: TTreeData): PVirtualNode;
var
Data: PTreeData;
begin
Result:=AVST.AddChild(ANode);
Data :=AVST.GetNodeData(Result);
AVST.ValidateNode(Result, False);
Data^.FCaption:=ARecord.FCaption;
end;
procedure TMainForm.Button1Click(Sender: TObject);
var
I: Integer;
TreeData: TTreeData;
begin
VST.NodeDataSize:=SizeOf(TTreeData);
VST.BeginUpdate;
for I:=0
to 100
do
begin
TreeData.FCaption := '
Node-Nummer: '+IntToStr(I);
AddVSTStructure(VST,
nil, TreeData);
end;
VST.EndUpdate;
end;
end.