I created this procedure
to populate a treeview:
procedure TFrmGerProfDock.Button1Click(Sender: TObject);
Var
Tables: TTreeNode;
I: Integer;
begin
for I := 0 to ds.DataSet.FieldCount - 1 do
begin
TreeView1.Items.BeginUpdate;
TreeView1.Items.Add(nil, ds.DataSet.Fields[I].FieldName); //adiciona um node novo
while not ds.DataSet.Eof do
begin
TreeView1.Items.AddChild(TreeView1.Items[I],
ds.DataSet.Fields[I].AsString);//adiciona ao node novos childs
ds.DataSet.Next;
end;
ds.DataSet.First;
TreeView1.Items.EndUpdate;
end;
end;
The problem is that procedure
always adds childs to the first node, what would be wrong in this code?