Board index » cppbuilder » Problems using TTreeView / TTreeNode / TTreeNodes

Problems using TTreeView / TTreeNode / TTreeNodes

I did not understand how to use a TTreeView yet.

How can I add a new child to a TTreeNode ?
A TTreeNode object can have children, but the AddChild methods only exists
for a TTreeNodes object, which is not the same.

Can anybody write an example, how to add a directory in the TTreeView and  a
file as
a child of it?

   thank you

     Egon Schmid

 

Re:Problems using TTreeView / TTreeNode / TTreeNodes


Quote
> Can anybody write an example, how to add a directory in the TTreeView and  a
> file as
> a child of it?

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   TTreeNode *ParentNode = TreeView1->Items->AddChild(
      NULL, "Directory");
   TTreeNode *ChildNode = TreeView1->Items->AddChild(
      ParentNode, "File");

Quote
}

--
Yoto Yotov

Other Threads