<!-- manual page source format generated by PolyglotMan v3.0.9, --> <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> <HTML> <HEAD> <TITLE>Blt_TreeCreateNode(3) manual page</TITLE> </HEAD> <BODY bgcolor=white> <A HREF="#toc">Table of Contents</A><P> <H2><A NAME="sect0" HREF="#toc0">Name</A></H2> Blt_TreeCreateNode - Creates a node in a tree data object. <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2> <BR> <PRE>#include <bltTree.h> Blt_TreeNode Blt_TreeCreateNode(tree, parent, name, position) </PRE> <H2><A NAME="sect2" HREF="#toc2">Arguments</A></H2> <P> Blt_Tree <I>tree</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Tree containing the parent node. <P> Blt_TreeNode <I>parent</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Node in which to insert the new child. <P> const char <I>*name</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Node label. If NULL, a label will automatically be generated. <P> int <I>position</I><tt> </tt> <tt> </tt> (in)<BR> <tt> </tt> <tt> </tt> Position in the parent's list of children to insert the new node. <H2><A NAME="sect3" HREF="#toc3">Description</A></H2> <P> This procedure creates a new node is a tree data object. The node is initially empty, but data values can be added with <B>Blt_TreeSetValue</B>. 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 <B>Blt_TreeNodeId</B>. <P> The arguments are as follows: <DL> <DT><I>tree</I> </DT> <DD>The tree containing the parent node. </DD> <DT><I>parent</I> </DT> <DD>Node in which the new child will be inserted. </DD> <DT><I>name</I> </DT> <DD>Label of the new node. If <I>name</I> is NULL, a label in the form "node0", "node1", etc. will automatically be generated. <I>Name</I> can be any string. Labels are non-unique. A parent can contain two nodes with the same label. Nodes can be relabeled using <B>Blt_TreeRelabelNode</B>. </DD> <DT><I>position</I> </DT> <DD>Position the parent's list of children to insert the new node. For example, if <I>position</I> is 0, then the new node is prepended to the beginning of the list. If <I>position</I> is -1, then the node is appended onto the end of the parent's list. </DD> </DL> <P> <H2><A NAME="sect4" HREF="#toc4">Returns</A></H2> The new node returned is of type <B>Blt_TreeNode</B>. It's a token that can be used with other routines to add/delete data values or children nodes. <H2><A NAME="sect5" HREF="#toc5">Example</A></H2> The following example creates a new node from the root node. <BR> <CODE>Blt_Tree token;<BR> Blt_TreeNode root, node;<BR> <P> if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) {<BR> return TCL_ERROR;<BR> }<BR> root = Blt_TreeRootNode(token);<BR> node = Blt_TreeCreateNode(token, root, "myNode", -1);<BR> <H2><A NAME="sect6" HREF="#toc6"></CODE>Notifications</A></H2> <B>Blt_TreeCreateNode</B> can trigger tree notify events. You can be notified whenever a node is created by using the <B>Blt_TreeCreateNotifyHandler</B>. A callback routine is registered that will be automatically invoked whenever a new node is added via <B>Blt_TreeCreateNode</B> to the tree. <H2><A NAME="sect7" HREF="#toc7">Keywords</A></H2> tree, token <P> <HR><P> <A NAME="toc"><B>Table of Contents</B></A><P> <UL> <LI><A NAME="toc0" HREF="#sect0">Name</A></LI> <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI> <LI><A NAME="toc2" HREF="#sect2">Arguments</A></LI> <LI><A NAME="toc3" HREF="#sect3">Description</A></LI> <LI><A NAME="toc4" HREF="#sect4">Returns</A></LI> <LI><A NAME="toc5" HREF="#sect5">Example</A></LI> <LI><A NAME="toc6" HREF="#sect6">Notifications</A></LI> <LI><A NAME="toc7" HREF="#sect7">Keywords</A></LI> </UL> </BODY></HTML>