home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _7e85790ac8bf8e0eb994e8ad982f7628 < prev    next >
Text File  |  2000-03-23  |  12KB  |  237 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Tk::Tree - Create and manipulate Tree widgets</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Tk::Tree - Create and manipulate Tree widgets</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#superclass">SUPER-CLASS</A></LI>
  25.     <LI><A HREF="#standard options">STANDARD OPTIONS</A></LI>
  26.     <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
  27.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  28.     <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
  29.     <LI><A HREF="#bindings">BINDINGS</A></LI>
  30.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  31.     <LI><A HREF="#author">AUTHOR</A></LI>
  32.     <LI><A HREF="#acknowledgements">ACKNOWLEDGEMENTS</A></LI>
  33. </UL>
  34. <!-- INDEX END -->
  35.  
  36. <HR>
  37. <P>
  38. <H1><A NAME="name">NAME</A></H1>
  39. <P>Tk::Tree - Create and manipulate Tree widgets</P>
  40. <P>
  41. <HR>
  42. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  43. <UL>
  44. <LI>Linux</LI>
  45. <LI>Solaris</LI>
  46. <LI>Windows</LI>
  47. </UL>
  48. <HR>
  49. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  50. <P>    <STRONG>use Tk::Tree;</STRONG></P>
  51. <P>    <EM>$tree</EM> = <EM>$parent</EM>-><STRONG>Tree</STRONG>(?<EM>options</EM>?);</P>
  52. <P>
  53. <HR>
  54. <H1><A NAME="superclass">SUPER-CLASS</A></H1>
  55. <P>The <STRONG>Tree</STRONG> class is derived from the <A HREF="../../../site/lib/Tk/HList.html">HList</A> class and inherits all
  56. the methods, options and subwidgets of its super-class.  A <STRONG>Tree</STRONG> widget is
  57. not scrolled by default.</P>
  58. <P>
  59. <HR>
  60. <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
  61. <P><STRONG>Tree</STRONG> supports all the standard options of an HList widget.
  62. See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details on the standard options.</P>
  63. <P>
  64. <HR>
  65. <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
  66. <DL>
  67. <DT><STRONG><A NAME="item_Name%3A_browseCmd">Name:        <STRONG>browseCmd</STRONG></A></STRONG><BR>
  68. <DD>
  69. <DT><STRONG><A NAME="item_Class%3A_BrowseCmd">Class:        <STRONG>BrowseCmd</STRONG></A></STRONG><BR>
  70. <DD>
  71. <DT><STRONG><A NAME="item_Switch%3A_%2Dbrowsecmd">Switch:        <STRONG>-browsecmd</STRONG></A></STRONG><BR>
  72. <DD>
  73. Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever the user browses on an entry
  74. (usually by single-clicking on the entry). The callback is called with
  75. one argument, the pathname of the entry.
  76. <P></P>
  77. <DT><STRONG><A NAME="item_Name%3A_closeCmd">Name:        <STRONG>closeCmd</STRONG></A></STRONG><BR>
  78. <DD>
  79. <DT><STRONG><A NAME="item_Class%3A_CloseCmd">Class:        <STRONG>CloseCmd</STRONG></A></STRONG><BR>
  80. <DD>
  81. <DT><STRONG><A NAME="item_Switch%3A_%2Dclosecmd">Switch:        <STRONG>-closecmd</STRONG></A></STRONG><BR>
  82. <DD>
  83. Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever an entry needs to be closed (See
  84. <A HREF="#bindings">BINDINGS</A> below). This method is called with one argument,
  85. the pathname of the entry. This method should perform appropriate
  86. actions to close the specified entry. If the <STRONG>-closecmd</STRONG> option
  87. is not specified, the default closing action is to hide all child
  88. entries of the specified entry.
  89. <P></P>
  90. <DT><STRONG><A NAME="item_Name%3A_command">Name:        <STRONG>command</STRONG></A></STRONG><BR>
  91. <DD>
  92. <DT><STRONG><A NAME="item_Class%3A_Command">Class:        <STRONG>Command</STRONG></A></STRONG><BR>
  93. <DD>
  94. <DT><STRONG><A NAME="item_Switch%3A_%2Dcommand">Switch:        <STRONG>-command</STRONG></A></STRONG><BR>
  95. <DD>
  96. Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever the user activates an entry
  97. (usually by double-clicking on the entry). The callback
  98. is called with one argument, the pathname of the entry.
  99. <P></P>
  100. <DT><STRONG><A NAME="item_Name%3A_ignoreInvoke">Name:        <STRONG>ignoreInvoke</STRONG></A></STRONG><BR>
  101. <DD>
  102. <DT><STRONG><A NAME="item_Class%3A_IgnoreInvoke">Class:        <STRONG>IgnoreInvoke</STRONG></A></STRONG><BR>
  103. <DD>
  104. <DT><STRONG><A NAME="item_Switch%3A_%2Dignoreinvoke">Switch:        <STRONG>-ignoreinvoke</STRONG></A></STRONG><BR>
  105. <DD>
  106. A Boolean value that specifies when a branch should be opened or
  107. closed. A branch will always be opened or closed when the user presses
  108. the (+) and (-) indicators. However, when the user invokes a branch
  109. (by doublc-clicking or pressing <Return>), the branch will be opened
  110. or closed only if <STRONG>-ignoreinvoke</STRONG> is set to false (the default
  111. setting).
  112. <P></P>
  113. <DT><STRONG><A NAME="item_Name%3A_openCmd">Name:        <STRONG>openCmd</STRONG></A></STRONG><BR>
  114. <DD>
  115. <DT><STRONG><A NAME="item_Class%3A_OpenCmd">Class:        <STRONG>OpenCmd</STRONG></A></STRONG><BR>
  116. <DD>
  117. <DT><STRONG><A NAME="item_Switch%3A_%2Dopencmd">Switch:        <STRONG>-opencmd</STRONG></A></STRONG><BR>
  118. <DD>
  119. Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever an entry needs to be opened (See
  120. <A HREF="#bindings">BINDINGS</A> below). This method is called with one argument,
  121. the pathname of the entry. This method should perform appropriate
  122. actions to open the specified entry. If the <STRONG>-opencmd</STRONG> option
  123. is not specified, the default opening action is to show all the child
  124. entries of the specified entry.
  125. <P></P></DL>
  126. <P>
  127. <HR>
  128. <H1><A NAME="description">DESCRIPTION</A></H1>
  129. <P>The <STRONG>Tree</STRONG> method creates a new window and makes it into a Tree widget
  130. and return a reference to it.  Additional options, described above, may
  131. be specified on the command line or in the option database to configure
  132. aspects of the Tree widget such as its cursor and relief.</P>
  133. <P>The Tree widget can be used to display hierarchical data in a tree
  134. form. The user can adjust the view of the tree by opening or closing
  135. parts of the tree.</P>
  136. <P>To display a static tree structure, you can add the entries into the
  137. Tree widget and hide any entries as desired. Then you can call
  138. the <STRONG>autosetmode</STRONG> method. This will set up the Tree widget so that it
  139. handles all the <EM>open</EM> and <EM>close</EM> events automatically.
  140. the demonstration program <EM>Tixish/examples/perl-tix-tree</EM>).</P>
  141. <P>The above method is not applicable if you want to maintain a dynamic tree
  142. structure, i.e, you do not know all the entries in the tree and you need
  143. to add or delete entries subsequently. To do this, you should first create
  144. the entries in the Tree widget. Then, use the <STRONG>setmode</STRONG> method to
  145. indicate the entries that can be opened or closed, and use the <STRONG>-opencmd</STRONG>
  146. and <STRONG>-closecmd</STRONG> options to handle the opening and closing events. (Please
  147. see the demonstration program <EM>Tixish/examples/perl-tix-dyntree</EM>).</P>
  148. <P>Use either</P>
  149. <P>    <EM>$parent</EM>-><STRONG>Scrolled</STRONG>(<STRONG>'Tree'</STRONG>, ... );</P>
  150. <P>or</P>
  151. <P>    <EM>$parent</EM>-><STRONG>ScrlTree</STRONG>( ... );</P>
  152. <P>to create a scrolled <STRONG>Tree</STRONG>. See <A HREF="../../../site/lib/Tk/Scrolled.html">the Tk::Scrolled manpage</A> for details.</P>
  153. <P>
  154. <HR>
  155. <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
  156. <P>The <STRONG>Tree</STRONG> method creates a widget object.
  157. This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
  158. described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
  159. modify the options described above.
  160. The widget also inherits all the methods provided by the generic
  161. <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
  162. <P>The following additional methods are available for Tree widgets:</P>
  163. <DL>
  164. <DT><STRONG><A NAME="item_autosetmode"><EM>$tree</EM>-><STRONG>autosetmode</STRONG></A></STRONG><BR>
  165. <DD>
  166. This method calls the <STRONG>setmode</STRONG> method for all the entries in
  167. this Tree widget: if an entry has no child entries, its mode is set to
  168. <STRONG>none</STRONG>. Otherwise, if the entry has any hidden child entries, its
  169. mode is set to <STRONG>open</STRONG>; otherwise its mode is set to <STRONG>close</STRONG>.
  170. <P></P>
  171. <DT><STRONG><A NAME="item_close"><EM>$tree</EM>-><STRONG>close</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
  172. <DD>
  173. Close the entry given by <EM>entryPath</EM> if its <EM>mode</EM> is <STRONG>close</STRONG>.
  174. <P></P>
  175. <DT><STRONG><A NAME="item_getmode"><EM>$tree</EM>-><STRONG>getmode</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
  176. <DD>
  177. Returns the current <EM>mode</EM> of the entry given by <EM>entryPath</EM>.
  178. <P></P>
  179. <DT><STRONG><A NAME="item_open"><EM>$tree</EM>-><STRONG>open</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
  180. <DD>
  181. Open the entry given by <EM>entryPath</EM> if its <EM>mode</EM> is <STRONG>open</STRONG>.
  182. <P></P>
  183. <DT><STRONG><A NAME="item_setmode"><EM>$tree</EM>-><STRONG>setmode</STRONG>(<EM>entryPath, mode</EM>)</A></STRONG><BR>
  184. <DD>
  185. This method is used to indicate whether the entry given by
  186. <EM>entryPath</EM> has children entries and whether the children are
  187. visible. <EM>mode</EM> must be one of <STRONG>open</STRONG>,
  188. <STRONG>close</STRONG> or <STRONG>none</STRONG>. If <EM>mode</EM> is set to <STRONG>open</STRONG>, a (+)
  189. indicator is drawn next the the entry. If <EM>mode</EM> is set to
  190. <STRONG>close</STRONG>, a (-) indicator is drawn next the the entry. If
  191. <EM>mode</EM> is set to <STRONG>none</STRONG>, no indicators will be drawn for this
  192. entry. The default <EM>mode</EM> is none. The <STRONG>open</STRONG> mode indicates
  193. the entry has hidden children and this entry can be opened by the
  194. user. The <STRONG>close</STRONG> mode indicates that all the children of the entry
  195. are now visible and the entry can be closed by the user.
  196. <P></P></DL>
  197. <P>
  198. <HR>
  199. <H1><A NAME="bindings">BINDINGS</A></H1>
  200. <P>The basic mouse and keyboard bindings of the Tree widget are the same
  201. as the <A HREF="../../../site/lib/Tk/HList.html#bindings">bindings of the HList</A> widget.
  202. In addition, the entries can be opened or closed under the following
  203. conditions:</P>
  204. <DL>
  205. <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
  206. <DD>
  207. If the <EM>mode</EM> of the entry is <STRONG>open</STRONG>, it can be opened by clicking
  208. on its (+) indicator.
  209. <P></P>
  210. <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
  211. <DD>
  212. If the <EM>mode</EM> of the entry is <STRONG>close</STRONG>, it can be closed by clicking
  213. on its (-) indicator.
  214. <P></P></DL>
  215. <P>
  216. <HR>
  217. <H1><A NAME="see also">SEE ALSO</A></H1>
  218. <P><A HREF="../../../site/lib/Tk/HList.html">Tk::HList</A></P>
  219. <P>
  220. <HR>
  221. <H1><A NAME="author">AUTHOR</A></H1>
  222. <P>Perl/TK version by Chris Dean <<A HREF="mailto:ctdean@cogit.com">ctdean@cogit.com</A>>.  Original Tcl/Tix
  223. version by Ioi Kim Lam.</P>
  224. <P>
  225. <HR>
  226. <H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1>
  227. <P>Thanks to Achim Bohnet <<A HREF="mailto:ach@mpe.mpg.de">ach@mpe.mpg.de</A>> for all his help.</P>
  228. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  229. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  230. <STRONG><P CLASS=block> Tk::Tree - Create and manipulate Tree widgets</P></STRONG>
  231. </TD></TR>
  232. </TABLE>
  233.  
  234. </BODY>
  235.  
  236. </HTML>
  237.