Files
cpython-source-deps/docs/html/TixBook/subsection3_7_2.html
2017-05-22 16:16:49 -05:00

53 lines
3.0 KiB
HTML

<HEAD>
<TITLE> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52>&nbsp;</A></TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
<FONT FACE="Tahoma, Arial, Helvetica">
<HR> <A NAME=tex2html1053 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1051 HREF=section3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1047 HREF=subsubsectionstar3_7_1_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1055 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html1054 HREF=section3_8.html> Tix Object Oriented </A>
<B>Up:</B> <A NAME=tex2html1052 HREF=section3_7.html> Selecting Files and </A>
<B> Previous:</B> <A NAME=tex2html1048 HREF=subsubsectionstar3_7_1_5.html> 5.1.5 The tix </A>
<HR> <P>
<A NAME=Contents>&nbsp;</A><H2><A NAME=SECTION00072000000000000000> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52>&nbsp;</A></A></H2>
<P>
There are two Tix widgets for selecting a directory: TixDirList (figure 5-6
) and TixDirTree (figure 5-6). Both of them
display the directories in a hierarchical format. The display in the
TixDirList widget is more compact: it shows only the parent- and
child-directories of a particular directory. The TixDirTree widget, on
the other hand, can display the whole tree structure of the file system.
<P>
The programming interface of these two widgets are the same and you can
choose the which one to use depending on your application. As shown in
the following example, you can use the <tt>-directory</tt> option of the
TixDirList widget to specify a directory to display. In the example, we
set <tt>-directory</tt> to be <tt>/home/ioi/dev</tt>. As a result, the
TixDirList widget displays all the subdirectories and all the ancestor
directories of <tt>/home/ioi/dev</tt>. You can use the <tt>-command</tt> and
<tt>-browsecmd</tt> options to handle the user events: a double click or
Return key-stroke will trigger the <tt>-command</tt> option and a single
click or space bar key stroke will trigger the <tt>-browsecmd</tt>
option. Normally, you would handle both type of events in the same
manner, as we have done in program 5-5
<P>
<blockquote> <P><tt> tixDirList .d -value /home/ioi/dev <BR> -command &quot;selectDir&quot; -browsecmd &quot;selectDir&quot;<BR>
pack .d<BR>
<BR>
proc selectDir {dir} {<BR>
puts &quot;now you select $dir&quot;<BR>
}</tt>
</blockquote>
<P><CENTER>(Figure 5-5) Using the TixDirList widget<A NAME=55>&nbsp;</A>
</CENTER>
<P>
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/hlist/dirtree.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/hlist/dirlist.gif"><BR CLEAR=LEFT><CENTER>(Figure 5-6) The DirTree and DirList Widgets<A NAME=56>&nbsp;</A></CENTER><P>
</CENTER>
</blockquote>
<P>
<HR>
</FONT>
</BODY>
<P><ADDRESS>
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
</ADDRESS>