home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Tree - Create and manipulate Tree widgets</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Tree - Create and manipulate Tree widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#superclass">SUPER-CLASS</A></LI>
- <LI><A HREF="#standard options">STANDARD OPTIONS</A></LI>
- <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
- <LI><A HREF="#bindings">BINDINGS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- <LI><A HREF="#acknowledgements">ACKNOWLEDGEMENTS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Tree - Create and manipulate Tree widgets</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P> <STRONG>use Tk::Tree;</STRONG></P>
- <P> <EM>$tree</EM> = <EM>$parent</EM>-><STRONG>Tree</STRONG>(?<EM>options</EM>?);</P>
- <P>
- <HR>
- <H1><A NAME="superclass">SUPER-CLASS</A></H1>
- <P>The <STRONG>Tree</STRONG> class is derived from the <A HREF="../../../site/lib/Tk/HList.html">HList</A> class and inherits all
- the methods, options and subwidgets of its super-class. A <STRONG>Tree</STRONG> widget is
- not scrolled by default.</P>
- <P>
- <HR>
- <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
- <P><STRONG>Tree</STRONG> supports all the standard options of an HList widget.
- See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details on the standard options.</P>
- <P>
- <HR>
- <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_Name%3A_browseCmd">Name: <STRONG>browseCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_BrowseCmd">Class: <STRONG>BrowseCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dbrowsecmd">Switch: <STRONG>-browsecmd</STRONG></A></STRONG><BR>
- <DD>
- Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever the user browses on an entry
- (usually by single-clicking on the entry). The callback is called with
- one argument, the pathname of the entry.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_closeCmd">Name: <STRONG>closeCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_CloseCmd">Class: <STRONG>CloseCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dclosecmd">Switch: <STRONG>-closecmd</STRONG></A></STRONG><BR>
- <DD>
- Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever an entry needs to be closed (See
- <A HREF="#bindings">BINDINGS</A> below). This method is called with one argument,
- the pathname of the entry. This method should perform appropriate
- actions to close the specified entry. If the <STRONG>-closecmd</STRONG> option
- is not specified, the default closing action is to hide all child
- entries of the specified entry.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_command">Name: <STRONG>command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Command">Class: <STRONG>Command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dcommand">Switch: <STRONG>-command</STRONG></A></STRONG><BR>
- <DD>
- Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever the user activates an entry
- (usually by double-clicking on the entry). The callback
- is called with one argument, the pathname of the entry.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_ignoreInvoke">Name: <STRONG>ignoreInvoke</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_IgnoreInvoke">Class: <STRONG>IgnoreInvoke</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dignoreinvoke">Switch: <STRONG>-ignoreinvoke</STRONG></A></STRONG><BR>
- <DD>
- A Boolean value that specifies when a branch should be opened or
- closed. A branch will always be opened or closed when the user presses
- the (+) and (-) indicators. However, when the user invokes a branch
- (by doublc-clicking or pressing <Return>), the branch will be opened
- or closed only if <STRONG>-ignoreinvoke</STRONG> is set to false (the default
- setting).
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_openCmd">Name: <STRONG>openCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_OpenCmd">Class: <STRONG>OpenCmd</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dopencmd">Switch: <STRONG>-opencmd</STRONG></A></STRONG><BR>
- <DD>
- Specifies a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> to call whenever an entry needs to be opened (See
- <A HREF="#bindings">BINDINGS</A> below). This method is called with one argument,
- the pathname of the entry. This method should perform appropriate
- actions to open the specified entry. If the <STRONG>-opencmd</STRONG> option
- is not specified, the default opening action is to show all the child
- entries of the specified entry.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Tree</STRONG> method creates a new window and makes it into a Tree widget
- and return a reference to it. Additional options, described above, may
- be specified on the command line or in the option database to configure
- aspects of the Tree widget such as its cursor and relief.</P>
- <P>The Tree widget can be used to display hierarchical data in a tree
- form. The user can adjust the view of the tree by opening or closing
- parts of the tree.</P>
- <P>To display a static tree structure, you can add the entries into the
- Tree widget and hide any entries as desired. Then you can call
- the <STRONG>autosetmode</STRONG> method. This will set up the Tree widget so that it
- handles all the <EM>open</EM> and <EM>close</EM> events automatically.
- the demonstration program <EM>Tixish/examples/perl-tix-tree</EM>).</P>
- <P>The above method is not applicable if you want to maintain a dynamic tree
- structure, i.e, you do not know all the entries in the tree and you need
- to add or delete entries subsequently. To do this, you should first create
- the entries in the Tree widget. Then, use the <STRONG>setmode</STRONG> method to
- indicate the entries that can be opened or closed, and use the <STRONG>-opencmd</STRONG>
- and <STRONG>-closecmd</STRONG> options to handle the opening and closing events. (Please
- see the demonstration program <EM>Tixish/examples/perl-tix-dyntree</EM>).</P>
- <P>Use either</P>
- <P> <EM>$parent</EM>-><STRONG>Scrolled</STRONG>(<STRONG>'Tree'</STRONG>, ... );</P>
- <P>or</P>
- <P> <EM>$parent</EM>-><STRONG>ScrlTree</STRONG>( ... );</P>
- <P>to create a scrolled <STRONG>Tree</STRONG>. See <A HREF="../../../site/lib/Tk/Scrolled.html">the Tk::Scrolled manpage</A> for details.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Tree</STRONG> method creates a widget object.
- This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
- described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
- modify the options described above.
- The widget also inherits all the methods provided by the generic
- <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
- <P>The following additional methods are available for Tree widgets:</P>
- <DL>
- <DT><STRONG><A NAME="item_autosetmode"><EM>$tree</EM>-><STRONG>autosetmode</STRONG></A></STRONG><BR>
- <DD>
- This method calls the <STRONG>setmode</STRONG> method for all the entries in
- this Tree widget: if an entry has no child entries, its mode is set to
- <STRONG>none</STRONG>. Otherwise, if the entry has any hidden child entries, its
- mode is set to <STRONG>open</STRONG>; otherwise its mode is set to <STRONG>close</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_close"><EM>$tree</EM>-><STRONG>close</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
- <DD>
- Close the entry given by <EM>entryPath</EM> if its <EM>mode</EM> is <STRONG>close</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_getmode"><EM>$tree</EM>-><STRONG>getmode</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
- <DD>
- Returns the current <EM>mode</EM> of the entry given by <EM>entryPath</EM>.
- <P></P>
- <DT><STRONG><A NAME="item_open"><EM>$tree</EM>-><STRONG>open</STRONG>(<EM>entryPath</EM>)</A></STRONG><BR>
- <DD>
- Open the entry given by <EM>entryPath</EM> if its <EM>mode</EM> is <STRONG>open</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_setmode"><EM>$tree</EM>-><STRONG>setmode</STRONG>(<EM>entryPath, mode</EM>)</A></STRONG><BR>
- <DD>
- This method is used to indicate whether the entry given by
- <EM>entryPath</EM> has children entries and whether the children are
- visible. <EM>mode</EM> must be one of <STRONG>open</STRONG>,
- <STRONG>close</STRONG> or <STRONG>none</STRONG>. If <EM>mode</EM> is set to <STRONG>open</STRONG>, a (+)
- indicator is drawn next the the entry. If <EM>mode</EM> is set to
- <STRONG>close</STRONG>, a (-) indicator is drawn next the the entry. If
- <EM>mode</EM> is set to <STRONG>none</STRONG>, no indicators will be drawn for this
- entry. The default <EM>mode</EM> is none. The <STRONG>open</STRONG> mode indicates
- the entry has hidden children and this entry can be opened by the
- user. The <STRONG>close</STRONG> mode indicates that all the children of the entry
- are now visible and the entry can be closed by the user.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="bindings">BINDINGS</A></H1>
- <P>The basic mouse and keyboard bindings of the Tree widget are the same
- as the <A HREF="../../../site/lib/Tk/HList.html#bindings">bindings of the HList</A> widget.
- In addition, the entries can be opened or closed under the following
- conditions:</P>
- <DL>
- <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
- <DD>
- If the <EM>mode</EM> of the entry is <STRONG>open</STRONG>, it can be opened by clicking
- on its (+) indicator.
- <P></P>
- <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
- <DD>
- If the <EM>mode</EM> of the entry is <STRONG>close</STRONG>, it can be closed by clicking
- on its (-) indicator.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../../site/lib/Tk/HList.html">Tk::HList</A></P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Perl/TK version by Chris Dean <<A HREF="mailto:ctdean@cogit.com">ctdean@cogit.com</A>>. Original Tcl/Tix
- version by Ioi Kim Lam.</P>
- <P>
- <HR>
- <H1><A NAME="acknowledgements">ACKNOWLEDGEMENTS</A></H1>
- <P>Thanks to Achim Bohnet <<A HREF="mailto:ach@mpe.mpg.de">ach@mpe.mpg.de</A>> for all his help.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Tree - Create and manipulate Tree widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-