RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TTreeNodes.AddNode Method

Add a node to a tree view.

Pascal
function AddNode(Node: TTreeNode; Relative: TTreeNode; const S: string; Ptr: TCustomData; Method: TNodeAttachMode): TTreeNode;
C++
__fastcall TTreeNode AddNode(TTreeNode Node, TTreeNode Relative, const AnsiString S, TCustomData Ptr, TNodeAttachMode Method);

AddNode adds a node object to the collection. AddNode returns the newly-added node, and takes the following parameters. 

Node is the node object to be added. If Node is nil, then the tree view's CreateNode method is called to provide one. 

The Relative and Method parameters together define the location of the new node. Relative is an existing node that will be either parent or sibling to the new node. Method specifies the precise relationship between the new node and relative, as given by a TNodeAttachMode constant. 

The S parameter specifies the Text property of the new node. 

The Ptr parameter specifies the Data property value of the new node.

Note: The memory referenced by Ptr is not freed when the tree nodes object is freed.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!