Board index » delphi » Treeview - Adding nodes to a completely blank treeview

Treeview - Adding nodes to a completely blank treeview

Hi,
how do I add nodes to a blank treeview.  I can add children to a parent node
but I want to do it all at runtime - ie start with a completely blanke tree
view, add 2 nodes, and then add multiple nodes to each of the 2 main nodes.
Please just supply the code to just add the 2 parents.

--
Thanks in Advance

Ant

 

Re:Treeview - Adding nodes to a completely blank treeview


The help has a fine example.

Finn Tolderlund

"AD" <anth...@adcruze.freeserve.co.uk> skrev i en meddelelse
news:3b8b50c2_2@dnews...

Quote
> how do I add nodes to a blank treeview.  I can add children to a parent
node
> but I want to do it all at runtime - ie start with a completely blanke
tree
> view, add 2 nodes, and then add multiple nodes to each of the 2 main
nodes.
> Please just supply the code to just add the 2 parents.

Re:Treeview - Adding nodes to a completely blank treeview


You can use ADD if you just want a 'textnode':

    ARootNode     := MyTreeview.Items.Add(nil, sNodeText);

or ADDOBJECT if you want to attach an object to the node:

    ARootNode     := MyTreeview.Items.AddObject(nil, sNodeText, myObject);

Han Timmers
Feather Soft

Quote
AD <anth...@adcruze.freeserve.co.uk> wrote in message

news:3b8b50c2_2@dnews...
Quote
> Hi,
> how do I add nodes to a blank treeview.  I can add children to a parent
node
> but I want to do it all at runtime - ie start with a completely blanke
tree
> view, add 2 nodes, and then add multiple nodes to each of the 2 main
nodes.
> Please just supply the code to just add the 2 parents.

> --
> Thanks in Advance

> Ant

Re:Treeview - Adding nodes to a completely blank treeview


Quote
In article <3b8b50c2_2@dnews>, Ad wrote:
> how do I add nodes to a blank treeview.  

  firstnode := treeview.items.Add( nil, somecaption );

The online help for TTreeItems.Add has an example.  For a more detailed
tutorial on treeviews you may want to visit

http://users.iafrica.com/d/da/dart/zen/Articles/TTreeView/TreeView.html

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Other Threads