Re: TreeView





Colin Basterfield wrote:
> Hi there,
>
> I am using TTreeView, and like my Conditional compilation question of
> yesterday I haven't ever used TreeView either, despite using Delphi since it
> first came out!!!
>
<snip>

Treeviews are a little strange to add nodes to (well I found them so
<g>).

The nodes are a TTreeNode in the TTreeView.Items (which is a TTreeNodeS
collection). To add a TTreeNode to a TTreeNodeS you call Add, AddChild,
AddFirst, or AddChildFirst specifying the appropriate node to add to as
a sibling or to add as a sibling child. A simple Add or AddChild adds
at the end of the siblings, AddFirst or AddFirstChild adds in the first
position. The TTreeNode added is returned by the call to Add???.

For adding the top level nodes you specify nil as the node to add to.

If you're iterating through the nodes TTreeView.Items.GetFirstNode,
followed by TTreeNode.GetNext??? on the returned node is quicker than
accessing them as an array of TTreeView.Items[].

Alan Lloyd

.



Relevant Pages

  • Re: TreeView Adding Problem
    ... but I wonder why the TreeView is so slow. ... TTreeView.Items.Insertto insert that TTreeNode. ... TTreeNode.GetNext until you have the treenode you want (how you know ... If you must go the route of having a set of TTreeNode, an array is ...
    (comp.lang.pascal.delphi.misc)
  • Re: How can I create group logic with using classes?
    ... And draw it on Treeview? ... Each line in your list corresponds to a tTreeNode. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Node
    ... With best regards, Mike Shkolnik ... > I have a TTreeNode and I want to add childs directly to this node instead ... > Then I'd like to add the entire node with its structure to a treeview. ...
    (borland.public.delphi.language.objectpascal)