Language Reference Guide : 4. System Classes : Tree Class : CopyNode Method
 
Share this page                  
CopyNode Method
The CopyNode method copies a node or branch from one place in a tree to another place in the same tree or a different tree. It returns the topmost copied node, or NULL on failure.
This method has the following syntax:
TreeNode = Tree.CopyNode(sourcenode = TreeNode, destnode = TreeNode,
          [relation = integer, childnumber = integer)
This method has the following parameters:
sourcenode
Specifies the node being copied. This does not have to be in the Tree of the method.
destnode
Specifies an existing treenode in the Tree.
relation
(Optional) Specifies the relationship of the node to the TreeNode specified in the destnode parameter. Valid values are:
TN_LASTCHILD
Specifies that the new node is the last child of destnode
TN_FIRSTCHILD
Specifies that the new node is the first child of destnode
TN_NEXTSIBLING
Specifies that the new node is the next sibling of destnode
TN_NUMBEREDCHILD
Specifies the nth child of destnode where n is provided by the childnumber parameter
Default: TN_LASTCHILD
childnumber
(Optional) Specifies the number of the child position of the copied node. If this is greater than the number of siblings, it is the same as TN_LASTCHILD.
Note:  This parameter only has meaning if relation is set to TN_NUMBEREDCHILD.