OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / blt2.5 / html / Blt_TreeCreateNode.html
1                                                                       
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 -->
4
5 <HTML>
6 <HEAD>
7 <TITLE>Blt_TreeCreateNode(3) manual page</TITLE>
8 </HEAD>
9 <BODY bgcolor=white>
10 <A HREF="#toc">Table of Contents</A><P>
11
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>
16 <BR>
17 <PRE>#include &lt;bltTree.h&gt;
18
19 Blt_TreeNode
20 Blt_TreeCreateNode(tree, parent, name, position)
21 </PRE>
22 <H2><A NAME="sect2" HREF="#toc2">Arguments</A></H2>
23 <P>
24 Blt_Tree   <I>tree</I><tt> </tt>&nbsp;<tt> </tt>&nbsp;(in)<BR>
25 <tt> </tt>&nbsp;<tt> </tt>&nbsp;Tree containing the parent node. <P>
26 Blt_TreeNode   <I>parent</I><tt> </tt>&nbsp;<tt> </tt>&nbsp;(in)<BR>
27 <tt> </tt>&nbsp;<tt> </tt>&nbsp;Node in which to insert the new child. <P>
28 const char   <I>*name</I><tt> </tt>&nbsp;<tt> </tt>&nbsp;(in)<BR>
29 <tt> </tt>&nbsp;<tt> </tt>&nbsp;Node label.  If NULL, a label will automatically be generated. <P>
30 int   <I>position</I><tt> </tt>&nbsp;<tt> </tt>&nbsp;(in)<BR>
31 <tt> </tt>&nbsp;<tt> </tt>&nbsp;Position in the parent's list of children to insert the new node. 
32 <H2><A NAME="sect3" HREF="#toc3">Description</A></H2>
33 <P>
34 This
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>.
39 <P>
40 The arguments are as follows: 
41 <DL>
42
43 <DT><I>tree</I> </DT>
44 <DD>The tree containing the parent node.
45 </DD>
46
47 <DT><I>parent</I> </DT>
48 <DD>Node in which the new child will be inserted.  </DD>
49
50 <DT><I>name</I> </DT>
51 <DD>Label of the
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>
56
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>
62 </DL>
63 <P>
64
65 <H2><A NAME="sect4" HREF="#toc4">Returns</A></H2>
66 The new node returned
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>
70 The following example
71 creates a new node from the root node. <BR>
72 <CODE>Blt_Tree token;<BR>
73 Blt_TreeNode root, node;<BR>
74 <P>
75 if (Blt_TreeGetToken(interp, "myTree", &amp;token) != TCL_OK) {<BR>
76     return TCL_ERROR;<BR>
77 }<BR>
78 root = Blt_TreeRootNode(token);<BR>
79 node = Blt_TreeCreateNode(token, root, "myNode", -1);<BR>
80
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>
87 tree, token
88 <P>
89
90 <HR><P>
91 <A NAME="toc"><B>Table of Contents</B></A><P>
92 <UL>
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>
101 </UL>
102 </BODY></HTML>