#include <bltTree.h> Blt_TreeNode Blt_TreeCreateNode(tree, parent, name, position)
Blt_Tree tree (in)
Tree containing the parent node.
Blt_TreeNode parent (in)
Node in which to insert the new child.
const char *name (in)
Node label. If NULL, a label will automatically be generated.
int position (in)
Position in the parent's list of children to insert the new node.
This procedure creates a new node is a tree data object. The node is initially empty, but data values can be added with Blt_TreeSetValue. Each node has a serial number that identifies it within the tree. No two nodes in the same tree will ever have the same ID. You can find a node's ID with Blt_TreeNodeId.
The arguments are as follows:
Blt_Tree token;
Blt_TreeNode root, node;
if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) {
return TCL_ERROR;
}
root = Blt_TreeRootNode(token);
node = Blt_TreeCreateNode(token, root, "myNode", -1);
Notifications
Blt_TreeCreateNode can trigger tree notify events. You can
be notified whenever a node is created by using the Blt_TreeCreateNotifyHandler.
A callback routine is registered that will be automatically invoked whenever
a new node is added via Blt_TreeCreateNode to the tree.