2 <!-- manual page source format generated by PolyglotMan v3.0.9, -->
3 <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
7 <TITLE>Blt_TreeCreateNode(3) manual page</TITLE>
10 <A HREF="#toc">Table of Contents</A><P>
12 <H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
13 Blt_TreeCreateNode - Creates a node
14 in a tree data object.
15 <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
17 <PRE>#include <bltTree.h>
20 Blt_TreeCreateNode(tree, parent, name, position)
22 <H2><A NAME="sect2" HREF="#toc2">Arguments</A></H2>
24 Blt_Tree <I>tree</I><tt> </tt> <tt> </tt> (in)<BR>
25 <tt> </tt> <tt> </tt> Tree containing the parent node. <P>
26 Blt_TreeNode <I>parent</I><tt> </tt> <tt> </tt> (in)<BR>
27 <tt> </tt> <tt> </tt> Node in which to insert the new child. <P>
28 const char <I>*name</I><tt> </tt> <tt> </tt> (in)<BR>
29 <tt> </tt> <tt> </tt> Node label. If NULL, a label will automatically be generated. <P>
30 int <I>position</I><tt> </tt> <tt> </tt> (in)<BR>
31 <tt> </tt> <tt> </tt> Position in the parent's list of children to insert the new node.
32 <H2><A NAME="sect3" HREF="#toc3">Description</A></H2>
35 procedure creates a new node is a tree data object. The node is initially
36 empty, but data values can be added with <B>Blt_TreeSetValue</B>. Each node has
37 a serial number that identifies it within the tree. No two nodes in the
38 same tree will ever have the same ID. You can find a node's ID with <B>Blt_TreeNodeId</B>.
40 The arguments are as follows:
44 <DD>The tree containing the parent node.
47 <DT><I>parent</I> </DT>
48 <DD>Node in which the new child will be inserted. </DD>
52 new node. If <I>name</I> is NULL, a label in the form "node0", "node1", etc.
53 will automatically be generated. <I>Name</I> can be any string. Labels are non-unique.
54 A parent can contain two nodes with the same label. Nodes can be relabeled
55 using <B>Blt_TreeRelabelNode</B>. </DD>
57 <DT><I>position</I> </DT>
58 <DD>Position the parent's list of children
59 to insert the new node. For example, if <I>position</I> is 0, then the new node
60 is prepended to the beginning of the list. If <I>position</I> is -1, then the node
61 is appended onto the end of the parent's list. </DD>
65 <H2><A NAME="sect4" HREF="#toc4">Returns</A></H2>
67 is of type <B>Blt_TreeNode</B>. It's a token that can be used with other routines
68 to add/delete data values or children nodes.
69 <H2><A NAME="sect5" HREF="#toc5">Example</A></H2>
71 creates a new node from the root node. <BR>
72 <CODE>Blt_Tree token;<BR>
73 Blt_TreeNode root, node;<BR>
75 if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) {<BR>
78 root = Blt_TreeRootNode(token);<BR>
79 node = Blt_TreeCreateNode(token, root, "myNode", -1);<BR>
81 <H2><A NAME="sect6" HREF="#toc6"></CODE>Notifications</A></H2>
82 <B>Blt_TreeCreateNode</B> can trigger tree notify events. You can
83 be notified whenever a node is created by using the <B>Blt_TreeCreateNotifyHandler</B>.
84 A callback routine is registered that will be automatically invoked whenever
85 a new node is added via <B>Blt_TreeCreateNode</B> to the tree.
86 <H2><A NAME="sect7" HREF="#toc7">Keywords</A></H2>
91 <A NAME="toc"><B>Table of Contents</B></A><P>
93 <LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
94 <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
95 <LI><A NAME="toc2" HREF="#sect2">Arguments</A></LI>
96 <LI><A NAME="toc3" HREF="#sect3">Description</A></LI>
97 <LI><A NAME="toc4" HREF="#sect4">Returns</A></LI>
98 <LI><A NAME="toc5" HREF="#sect5">Example</A></LI>
99 <LI><A NAME="toc6" HREF="#sect6">Notifications</A></LI>
100 <LI><A NAME="toc7" HREF="#sect7">Keywords</A></LI>