Como usar array / typecast em TTreeview

Delphi

30/08/2004

Pessoal,

Tem como fazer um typecast para que ao criar
um nó ao varrer o bd eu consiga criar os
filhos sob este nó?
No caso eu tenho fixo por exemplo 14 nós.
No bd sob o nó 1 tenho 5 elementos que seriam os filhos
sob o nó1, 3 filhos sob o nó 2 e assim por diante, porém
estão gravados aleatóriamente no bd(Access/Jet4/Adoconnection)


procedure TfrmAbertura.FormShow(Sender: TObject);
var
no1: TTreeNode;// tentei fazer no como array of integer
a,b,ultimo,t: integer;
nl:string;
begin
with tr1.Items do
begin
Clear;
DM.tblECGCl.Close;
DM.tblECGCl.Open;
for t := 1 to 14 do
begin
case t of
1:nl:=´categoria1´;
2:nl:=´categoria2´;
...

end;
Add(no1,nl);
DM.tblECGCl.First;
while DM.tblECGCl.Eof = false do
begin
if DM.tblECGCltipo.AsInteger = t then
begin
nl:=DM.tblECGCldiagECG.AsString;
AddChild(no1,nl);
end;
DM.tblECGCl.Next;
end;
end;
end;


N1

N1

Curtidas 0
POSTAR