Import Tix 8.4.3.5 (as of svn r86089)
This commit is contained in:
81
docs/html/TixBook/TixBook.html
Normal file
81
docs/html/TixBook/TixBook.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<HEAD>
|
||||
<TITLE>Tix Programming Guide</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif_gr.gif"> <IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif_gr.gif"> <A NAME=tex2html3 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html2 HREF=tableofcontents3_1.html>Contents</A>
|
||||
<HR> <P>
|
||||
<P>
|
||||
<CENTER><H1>The Tix Programming Guide</H1>
|
||||
<P><b>
|
||||
Tix Group,<BR><i><A HREF="http://tix.sourceforge.net">http://tix.sourceforge.net</A>
|
||||
</i>
|
||||
</b><P>
|
||||
<P><b>
|
||||
<P>
|
||||
<IMG SRC="../gif/tix/tix32.gif">
|
||||
<P>
|
||||
</b><P>
|
||||
</CENTER>
|
||||
<P>
|
||||
<P>Fri Nov 30 00:51:12 PST 2001
|
||||
.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html4 HREF=tableofcontents3_1.html#SECTION00010000000000000000>Contents</A>
|
||||
<LI> <A NAME=tex2html5 HREF=sectionstar3_2.html#SECTION00020000000000000000> Preface</A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html6 HREF=subsectionstar3_2_1.html#SECTION00021000000000000000> About This Manual<A NAME=01> </A></A>
|
||||
<LI> <A NAME=tex2html7 HREF=subsectionstar3_2_2.html#SECTION00022000000000000000> About This Document<A NAME=02> </A></A>
|
||||
<LI> <A NAME=tex2html8 HREF=subsectionstar3_2_3.html#SECTION00023000000000000000> Organization of This Manual<A NAME=03> </A><A NAME=04> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html9 HREF=section3_3.html#SECTION00030000000000000000> Introduction<A NAME=1> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html10 HREF=subsection3_3_1.html#SECTION00031000000000000000> What is Tix<A NAME=11> </A></A>
|
||||
<LI> <A NAME=tex2html11 HREF=subsection3_3_2.html#SECTION00032000000000000000> Getting Started: the TixControl Widget<A NAME=12> </A></A>
|
||||
<LI> <A NAME=tex2html12 HREF=subsection3_3_3.html#SECTION00033000000000000000> Accessing The Components Inside Mega Widgets<A NAME=13> </A></A>
|
||||
<LI> <A NAME=tex2html13 HREF=subsection3_3_4.html#SECTION00034000000000000000> Another Tix Widget: TixComboBox<A NAME=14> </A></A>
|
||||
<LI> <A NAME=tex2html14 HREF=subsection3_3_5.html#SECTION00035000000000000000> The TixSelect Widget<A NAME=15> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html15 HREF=section3_4.html#SECTION00040000000000000000> Container Widgets<A NAME=2> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html16 HREF=subsection3_4_1.html#SECTION00041000000000000000> TixNoteBook<A NAME=21> </A></A>
|
||||
<LI> <A NAME=tex2html17 HREF=subsection3_4_2.html#SECTION00042000000000000000> PanedWindow<A NAME=22> </A></A>
|
||||
<LI> <A NAME=tex2html18 HREF=subsection3_4_3.html#SECTION00043000000000000000> The Family of Scrolled Widgets<A NAME=23> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html19 HREF=section3_5.html#SECTION00050000000000000000> Tabular Listbox and Display Items<A NAME=3> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html20 HREF=subsection3_5_1.html#SECTION00051000000000000000> tixTList - The Tix Tabular Listbox Widget<A NAME=31> </A></A>
|
||||
<LI> <A NAME=tex2html21 HREF=subsection3_5_2.html#SECTION00052000000000000000> Display Items<A NAME=32> </A></A>
|
||||
<LI> <A NAME=tex2html22 HREF=subsection3_5_3.html#SECTION00053000000000000000> Creating Display Items in the TixTList Widget<A NAME=33> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html23 HREF=section3_6.html#SECTION00060000000000000000> Hierarchical Listbox<A NAME=4> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html24 HREF=subsection3_6_1.html#SECTION00061000000000000000> TixHList - The Tix Hierarchical Listbox Widget<A NAME=41> </A></A>
|
||||
<LI> <A NAME=tex2html25 HREF=subsection3_6_2.html#SECTION00062000000000000000> Creating Collapsible Tree Structures with TixTree<A NAME=42> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html26 HREF=section3_7.html#SECTION00070000000000000000> Selecting Files and Directories<A NAME=5> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html27 HREF=subsection3_7_1.html#SECTION00071000000000000000> File Selection Dialog Widgets<A NAME=51> </A></A>
|
||||
<LI> <A NAME=tex2html28 HREF=subsection3_7_2.html#SECTION00072000000000000000> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html29 HREF=section3_8.html#SECTION00080000000000000000> Tix Object Oriented Programming<A NAME=6> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html30 HREF=subsection3_8_1.html#SECTION00081000000000000000> Introduction to Tix Object Oriented Programming<A NAME=61> </A></A>
|
||||
<LI> <A NAME=tex2html31 HREF=subsection3_8_2.html#SECTION00082000000000000000> Widget Class Declaration<A NAME=62> </A></A>
|
||||
<LI> <A NAME=tex2html32 HREF=subsection3_8_3.html#SECTION00083000000000000000> Writing Methods<A NAME=63> </A></A>
|
||||
<LI> <A NAME=tex2html33 HREF=subsection3_8_4.html#SECTION00084000000000000000> Standard Initialization Methods<A NAME=64> </A></A>
|
||||
<LI> <A NAME=tex2html34 HREF=subsection3_8_5.html#SECTION00085000000000000000> Declaring and Using Variables<A NAME=65> </A></A>
|
||||
<LI> <A NAME=tex2html35 HREF=subsection3_8_6.html#SECTION00086000000000000000> Summary of Widget Instance Initialization<A NAME=66> </A></A>
|
||||
<LI> <A NAME=tex2html36 HREF=subsection3_8_7.html#SECTION00087000000000000000> Loading the New Classes<A NAME=67> </A></A>
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
5
docs/html/TixBook/images.pl
Normal file
5
docs/html/TixBook/images.pl
Normal file
@@ -0,0 +1,5 @@
|
||||
# LaTeX2HTML 0.5.3 (Wed Jan 26 1994)
|
||||
# Associate image original text (scrambled) with physical files.
|
||||
|
||||
|
||||
1;
|
||||
131
docs/html/TixBook/labels.pl
Normal file
131
docs/html/TixBook/labels.pl
Normal file
@@ -0,0 +1,131 @@
|
||||
# LaTeX2HTML 0.5.3 (Wed Jan 26 1994)
|
||||
# Associate symbolic labels with physical files.
|
||||
|
||||
$external_labels{"65"} ="$URL/subsection3_8_5.html";
|
||||
$external_labels{"335"} ="$URL/subsubsection3_5_3_5.html";
|
||||
$external_labels{"137"} ="$URL/subsubsection3_3_3_7.html";
|
||||
$external_labels{"3"} ="$URL/section3_5.html";
|
||||
$external_labels{"12"} ="$URL/subsubsection3_3_2_1.html";
|
||||
$external_labels{"642"} ="$URL/subsubsection3_8_4_4.html";
|
||||
$external_labels{"514"} ="$URL/subsubsection3_7_1_4.html";
|
||||
$external_labels{"111"} ="$URL/subsubsection3_3_5_1.html";
|
||||
$external_labels{"31"} ="$URL/subsection3_5_1.html";
|
||||
$external_labels{"24"} ="$URL/subsection3_4_2.html";
|
||||
$external_labels{"17"} ="$URL/subsubsection3_3_3_6.html";
|
||||
$external_labels{"652"} ="$URL/subsubsection3_8_5_3.html";
|
||||
$external_labels{"121"} ="$URL/subsubsection3_3_2_1.html";
|
||||
$external_labels{"43"} ="$URL/subsubsection3_6_1_1.html";
|
||||
$external_labels{"36"} ="$URL/subsubsection3_5_3_4.html";
|
||||
$external_labels{"29"} ="$URL/subsubsection3_4_3_2.html";
|
||||
$external_labels{"336"} ="$URL/subsubsection3_5_3_6.html";
|
||||
$external_labels{"131"} ="$URL/subsubsection3_3_3_1.html";
|
||||
$external_labels{"62"} ="$URL/subsubsection3_8_2_1.html";
|
||||
$external_labels{"55"} ="$URL/subsection3_7_2.html";
|
||||
$external_labels{"643"} ="$URL/subsubsection3_8_4_5.html";
|
||||
$external_labels{"6412"} ="$URL/subsubsectionstar3_8_4_3.html";
|
||||
$external_labels{"6122"} ="$URL/subsubsectionstar3_8_1_4.html";
|
||||
$external_labels{"515"} ="$URL/subsubsectionstar3_7_1_5.html";
|
||||
$external_labels{"211"} ="$URL/subsubsection3_4_1_1.html";
|
||||
$external_labels{"141"} ="$URL/subsubsection3_3_4_1.html";
|
||||
$external_labels{"112"} ="$URL/subsubsectionstar3_3_5_3.html";
|
||||
$external_labels{"02"} ="$URL/subsectionstar3_2_2.html";
|
||||
$external_labels{"67"} ="$URL/subsection3_8_7.html";
|
||||
$external_labels{"1511"} ="$URL/subsubsectionstar3_3_5_2.html";
|
||||
$external_labels{"1221"} ="$URL/subsubsectionstar3_3_2_3.html";
|
||||
$external_labels{"221"} ="$URL/subsubsection3_4_2_1.html";
|
||||
$external_labels{"21"} ="$URL/subsection3_4_1.html";
|
||||
$external_labels{"151"} ="$URL/subsubsection3_3_5_1.html";
|
||||
$external_labels{"122"} ="$URL/subsubsection3_3_2_2.html";
|
||||
$external_labels{"14"} ="$URL/subsection3_3_4.html";
|
||||
$external_labels{"2"} ="$URL/section3_4.html";
|
||||
$external_labels{"33"} ="$URL/subsection3_5_3.html";
|
||||
$external_labels{"231"} ="$URL/subsubsection3_4_3_1.html";
|
||||
$external_labels{"26"} ="$URL/subsubsection3_4_2_2.html";
|
||||
$external_labels{"19"} ="$URL/subsubsection3_3_4_1.html";
|
||||
$external_labels{"132"} ="$URL/subsubsection3_3_3_2.html";
|
||||
$external_labels{"6"} ="$URL/section3_8.html";
|
||||
$external_labels{"52"} ="$URL/subsection3_7_2.html";
|
||||
$external_labels{"45"} ="$URL/subsubsection3_6_1_2.html";
|
||||
$external_labels{"212"} ="$URL/subsubsection3_4_1_2.html";
|
||||
$external_labels{"113"} ="$URL/subsubsection3_3_5_5.html";
|
||||
$external_labels{"142"} ="$URL/subsubsection3_3_4_2.html";
|
||||
$external_labels{"64"} ="$URL/subsection3_8_4.html";
|
||||
$external_labels{"321"} ="$URL/subsubsection3_5_2_1.html";
|
||||
$external_labels{"222"} ="$URL/subsubsection3_4_2_2.html";
|
||||
$external_labels{"152"} ="$URL/subsubsection3_3_5_5.html";
|
||||
$external_labels{"123"} ="$URL/subsubsection3_3_2_4.html";
|
||||
$external_labels{"04"} ="$URL/subsectionstar3_2_3.html";
|
||||
$external_labels{"11"} ="$URL/subsubsection3_3_1_1.html";
|
||||
$external_labels{"331"} ="$URL/subsubsection3_5_3_1.html";
|
||||
$external_labels{"232"} ="$URL/subsubsection3_4_3_2.html";
|
||||
$external_labels{"133"} ="$URL/subsubsection3_3_3_3.html";
|
||||
$external_labels{"6521"} ="$URL/subsubsectionstar3_8_5_4.html";
|
||||
$external_labels{"23"} ="$URL/subsection3_4_3.html";
|
||||
$external_labels{"16"} ="$URL/subsubsection3_3_3_5.html";
|
||||
$external_labels{"411"} ="$URL/subsubsection3_6_1_1.html";
|
||||
$external_labels{"213"} ="$URL/subsubsection3_4_1_3.html";
|
||||
$external_labels{"114"} ="$URL/subsubsection3_3_5_7.html";
|
||||
$external_labels{"143"} ="$URL/subsubsection3_3_4_3.html";
|
||||
$external_labels{"1"} ="$URL/section3_3.html";
|
||||
$external_labels{"6411"} ="$URL/subsubsectionstar3_8_4_2.html";
|
||||
$external_labels{"6121"} ="$URL/subsubsectionstar3_8_1_3.html";
|
||||
$external_labels{"42"} ="$URL/subsection3_6_2.html";
|
||||
$external_labels{"35"} ="$URL/subsubsection3_5_3_2.html";
|
||||
$external_labels{"28"} ="$URL/subsubsection3_4_3_1.html";
|
||||
$external_labels{"322"} ="$URL/subsubsection3_5_2_2.html";
|
||||
$external_labels{"223"} ="$URL/subsubsection3_4_2_3.html";
|
||||
$external_labels{"153"} ="$URL/subsubsection3_3_5_6.html";
|
||||
$external_labels{"TableofContents"} ="$URL/tableofcontents3_1.html";
|
||||
$external_labels{"61"} ="$URL/subsubsection3_8_1_1.html";
|
||||
$external_labels{"54"} ="$URL/subsubsectionstar3_7_1_5.html";
|
||||
$external_labels{"5"} ="$URL/section3_7.html";
|
||||
$external_labels{"47"} ="$URL/subsection3_6_2.html";
|
||||
$external_labels{"332"} ="$URL/subsubsection3_5_3_2.html";
|
||||
$external_labels{"1513"} ="$URL/subsubsectionstar3_3_5_4.html";
|
||||
$external_labels{"134"} ="$URL/subsubsection3_3_3_4.html";
|
||||
$external_labels{"01"} ="$URL/subsectionstar3_2_1.html";
|
||||
$external_labels{"66"} ="$URL/subsection3_8_6.html";
|
||||
$external_labels{"511"} ="$URL/subsubsection3_7_1_1.html";
|
||||
$external_labels{"412"} ="$URL/subsubsection3_6_1_2.html";
|
||||
$external_labels{"214"} ="$URL/subsubsection3_4_1_4.html";
|
||||
$external_labels{"144"} ="$URL/subsubsection3_3_4_4.html";
|
||||
$external_labels{"13"} ="$URL/subsection3_3_3.html";
|
||||
$external_labels{"224"} ="$URL/subsubsection3_4_2_4.html";
|
||||
$external_labels{"154"} ="$URL/subsubsection3_3_5_7.html";
|
||||
$external_labels{"Contents"} ="$URL/subsection3_8_7.html";
|
||||
$external_labels{"32"} ="$URL/subsection3_5_2.html";
|
||||
$external_labels{"25"} ="$URL/subsubsection3_4_2_1.html";
|
||||
$external_labels{"18"} ="$URL/subsection3_3_4.html";
|
||||
$external_labels{"333"} ="$URL/subsubsection3_5_3_3.html";
|
||||
$external_labels{"135"} ="$URL/subsubsection3_3_3_5.html";
|
||||
$external_labels{"51"} ="$URL/subsubsection3_7_1_1.html";
|
||||
$external_labels{"44"} ="$URL/subsubsection3_6_1_2.html";
|
||||
$external_labels{"6511"} ="$URL/subsubsectionstar3_8_5_2.html";
|
||||
$external_labels{"611"} ="$URL/subsubsection3_8_1_1.html";
|
||||
$external_labels{"512"} ="$URL/subsubsection3_7_1_2.html";
|
||||
$external_labels{"413"} ="$URL/subsubsection3_6_1_3.html";
|
||||
$external_labels{"63"} ="$URL/subsection3_8_3.html";
|
||||
$external_labels{"56"} ="$URL/subsection3_7_2.html";
|
||||
$external_labels{"4"} ="$URL/section3_6.html";
|
||||
$external_labels{"621"} ="$URL/subsubsection3_8_2_1.html";
|
||||
$external_labels{"03"} ="$URL/subsectionstar3_2_3.html";
|
||||
$external_labels{"631"} ="$URL/subsubsection3_8_3_1.html";
|
||||
$external_labels{"6123"} ="$URL/subsubsectionstar3_8_1_5.html";
|
||||
$external_labels{"334"} ="$URL/subsubsection3_5_3_4.html";
|
||||
$external_labels{"22"} ="$URL/subsection3_4_2.html";
|
||||
$external_labels{"15"} ="$URL/subsection3_3_5.html";
|
||||
$external_labels{"136"} ="$URL/subsubsection3_3_3_6.html";
|
||||
$external_labels{"641"} ="$URL/subsubsection3_8_4_1.html";
|
||||
$external_labels{"612"} ="$URL/subsubsection3_8_1_2.html";
|
||||
$external_labels{"513"} ="$URL/subsubsection3_7_1_3.html";
|
||||
$external_labels{"414"} ="$URL/subsubsection3_6_1_4.html";
|
||||
$external_labels{"41"} ="$URL/subsection3_6_1.html";
|
||||
$external_labels{"34"} ="$URL/subsubsection3_5_2_2.html";
|
||||
$external_labels{"27"} ="$URL/subsubsection3_4_3_1.html";
|
||||
$external_labels{"1512"} ="$URL/subsubsectionstar3_3_5_3.html";
|
||||
$external_labels{"110"} ="$URL/subsection3_3_5.html";
|
||||
$external_labels{"651"} ="$URL/subsubsection3_8_5_1.html";
|
||||
$external_labels{"53"} ="$URL/subsubsection3_7_1_3.html";
|
||||
$external_labels{"46"} ="$URL/subsection3_6_2.html";
|
||||
|
||||
1;
|
||||
62
docs/html/TixBook/section3_3.html
Normal file
62
docs/html/TixBook/section3_3.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<HEAD>
|
||||
<TITLE> Introduction<A NAME=1> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html200 HREF=subsection3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html198 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html192 HREF=subsectionstar3_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html202 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html201 HREF=subsection3_3_1.html> What is Tix</A>
|
||||
<B>Up:</B> <A NAME=tex2html199 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html193 HREF=subsectionstar3_2_3.html> Organization of This </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00030000000000000000> Introduction<A NAME=1> </A></A></H1>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html203 HREF=subsection3_3_1.html#SECTION00031000000000000000> What is Tix<A NAME=11> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html204 HREF=subsubsection3_3_1_1.html#SECTION00031100000000000000> Tix for Application Programmers<A NAME=111> </A></A>
|
||||
<LI> <A NAME=tex2html205 HREF=subsubsection3_3_1_2.html#SECTION00031200000000000000> Tix for Widget Developers<A NAME=112> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html206 HREF=subsection3_3_2.html#SECTION00032000000000000000> Getting Started: the TixControl Widget<A NAME=12> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html207 HREF=subsubsection3_3_2_1.html#SECTION00032100000000000000> Creating a TixControl Widget<A NAME=121> </A></A>
|
||||
<LI> <A NAME=tex2html208 HREF=subsubsection3_3_2_2.html#SECTION00032200000000000000> Accessing The Value of a TixControl Widget<A NAME=122> </A></A>
|
||||
<LI> <A NAME=tex2html209 HREF=subsubsectionstar3_3_2_3.html#SECTION00032300000000000000> Disabling Callbacks Temporarily<A NAME=1221> </A></A>
|
||||
<LI> <A NAME=tex2html210 HREF=subsubsection3_3_2_4.html#SECTION00032400000000000000> Validating User Inputs<A NAME=123> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html211 HREF=subsection3_3_3.html#SECTION00033000000000000000> Accessing The Components Inside Mega Widgets<A NAME=13> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html212 HREF=subsubsection3_3_3_1.html#SECTION00033100000000000000> Subwidgets<A NAME=131> </A></A>
|
||||
<LI> <A NAME=tex2html213 HREF=subsubsection3_3_3_2.html#SECTION00033200000000000000> Subwidget Names<A NAME=132> </A></A>
|
||||
<LI> <A NAME=tex2html214 HREF=subsubsection3_3_3_3.html#SECTION00033300000000000000> The <tt>subwidget</tt> Method<A NAME=133> </A></A>
|
||||
<LI> <A NAME=tex2html215 HREF=subsubsection3_3_3_4.html#SECTION00033400000000000000> Chaining the <tt>subwidget</tt> Method<A NAME=134> </A></A>
|
||||
<LI> <A NAME=tex2html216 HREF=subsubsection3_3_3_5.html#SECTION00033500000000000000> Configuring Subwidget Options Using the <tt>-options</tt> Switch<A NAME=135> </A></A>
|
||||
<LI> <A NAME=tex2html217 HREF=subsubsection3_3_3_6.html#SECTION00033600000000000000> Configuring Subwidget Options Using the Tk Option Database<A NAME=136> </A></A>
|
||||
<LI> <A NAME=tex2html218 HREF=subsubsection3_3_3_7.html#SECTION00033700000000000000> Caution: Restricted Access<A NAME=137> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html219 HREF=subsection3_3_4.html#SECTION00034000000000000000> Another Tix Widget: TixComboBox<A NAME=14> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html220 HREF=subsubsection3_3_4_1.html#SECTION00034100000000000000> Creating a TixComboBox Widget<A NAME=141> </A></A>
|
||||
<LI> <A NAME=tex2html221 HREF=subsubsection3_3_4_2.html#SECTION00034200000000000000> Controlling the Style of the TixComboBox<A NAME=142> </A></A>
|
||||
<LI> <A NAME=tex2html222 HREF=subsubsection3_3_4_3.html#SECTION00034300000000000000> Static Options<A NAME=143> </A></A>
|
||||
<LI> <A NAME=tex2html223 HREF=subsubsection3_3_4_4.html#SECTION00034400000000000000> Monitoring the User's Browsing Actions<A NAME=144> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html224 HREF=subsection3_3_5.html#SECTION00035000000000000000> The TixSelect Widget<A NAME=15> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html225 HREF=subsubsection3_3_5_1.html#SECTION00035100000000000000> Creating A TixSelect Widget<A NAME=151> </A></A>
|
||||
<LI> <A NAME=tex2html226 HREF=subsubsectionstar3_3_5_2.html#SECTION00035200000000000000> Label and Orientation<A NAME=1511> </A></A>
|
||||
<LI> <A NAME=tex2html227 HREF=subsubsectionstar3_3_5_3.html#SECTION00035300000000000000> Creating the Button Subwidgets and Configuring
|
||||
Their Appearance<A NAME=1512> </A></A>
|
||||
<LI> <A NAME=tex2html228 HREF=subsubsectionstar3_3_5_4.html#SECTION00035400000000000000> Accessing the Button Subwidgets<A NAME=1513> </A></A>
|
||||
<LI> <A NAME=tex2html229 HREF=subsubsection3_3_5_5.html#SECTION00035500000000000000> Specifying Selection Rules<A NAME=152> </A></A>
|
||||
<LI> <A NAME=tex2html230 HREF=subsubsection3_3_5_6.html#SECTION00035600000000000000> Accessing the Value of a TixSelect Widget<A NAME=153> </A></A>
|
||||
<LI> <A NAME=tex2html231 HREF=subsubsection3_3_5_7.html#SECTION00035700000000000000> Specifying Complex Selection Rules<A NAME=154> </A></A>
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
53
docs/html/TixBook/section3_4.html
Normal file
53
docs/html/TixBook/section3_4.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HEAD>
|
||||
<TITLE> Container Widgets<A NAME=2> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html571 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html569 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html563 HREF=subsubsection3_3_5_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html573 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html572 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<B>Up:</B> <A NAME=tex2html570 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html564 HREF=subsubsection3_3_5_7.html> Specifying Complex Selection </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00040000000000000000> Container Widgets<A NAME=2> </A></A></H1>
|
||||
<P>
|
||||
In addition to providing some nice-looking interface elements, Tix
|
||||
offers some useful ways to organize the elements that you create.
|
||||
It does this by providing <em>container widgets</em>, which are widgets
|
||||
designed to contain whatever you want to put into them.
|
||||
<P>
|
||||
Different container widgets have different policies as to how they
|
||||
arrange the widgets inside them. In this chapter, we'll talk about
|
||||
TixNoteBook, which arranges its subwidgets using a notebook metaphor,
|
||||
TixPanedWindow, which arranges its subwidgets in non-overlapping
|
||||
horizontal or vertical panes, and a family of ``Scrolled Widgets'', which
|
||||
attach scrollbars to their subwidgets.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html574 HREF=subsection3_4_1.html#SECTION00041000000000000000> TixNoteBook<A NAME=21> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html575 HREF=subsubsection3_4_1_1.html#SECTION00041100000000000000> Adding Pages to a TixNoteBook<A NAME=211> </A></A>
|
||||
<LI> <A NAME=tex2html576 HREF=subsubsection3_4_1_2.html#SECTION00041200000000000000> Keyboard Accelerators<A NAME=212> </A></A>
|
||||
<LI> <A NAME=tex2html577 HREF=subsubsection3_4_1_3.html#SECTION00041300000000000000> Delaying the Creation of New Pages<A NAME=213> </A></A>
|
||||
<LI> <A NAME=tex2html578 HREF=subsubsection3_4_1_4.html#SECTION00041400000000000000> Changing Page Tabs and Deleting Pages<A NAME=214> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html579 HREF=subsection3_4_2.html#SECTION00042000000000000000> PanedWindow<A NAME=22> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html580 HREF=subsubsection3_4_2_1.html#SECTION00042100000000000000> Adding Panes Inside a TixPanedWindow Widget<A NAME=221> </A></A>
|
||||
<LI> <A NAME=tex2html581 HREF=subsubsection3_4_2_2.html#SECTION00042200000000000000> Putting Widgets Inside the Panes<A NAME=222> </A></A>
|
||||
<LI> <A NAME=tex2html582 HREF=subsubsection3_4_2_3.html#SECTION00042300000000000000> Setting the Order of the Panes<A NAME=223> </A></A>
|
||||
<LI> <A NAME=tex2html583 HREF=subsubsection3_4_2_4.html#SECTION00042400000000000000> Changing the Sizes of the Panes<A NAME=224> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html584 HREF=subsection3_4_3.html#SECTION00043000000000000000> The Family of Scrolled Widgets<A NAME=23> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html585 HREF=subsubsection3_4_3_1.html#SECTION00043100000000000000> The Scrolled Listbox Widget<A NAME=231> </A></A>
|
||||
<LI> <A NAME=tex2html586 HREF=subsubsection3_4_3_2.html#SECTION00043200000000000000> Other Scrolled Widgets<A NAME=232> </A></A>
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
37
docs/html/TixBook/section3_5.html
Normal file
37
docs/html/TixBook/section3_5.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<HEAD>
|
||||
<TITLE> Tabular Listbox and Display Items<A NAME=3> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html740 HREF=subsection3_5_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html738 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html732 HREF=subsubsection3_4_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html742 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html741 HREF=subsection3_5_1.html> tixTList - The </A>
|
||||
<B>Up:</B> <A NAME=tex2html739 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html733 HREF=subsubsection3_4_3_2.html> Other Scrolled Widgets</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00050000000000000000> Tabular Listbox and Display Items<A NAME=3> </A></A></H1>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html743 HREF=subsection3_5_1.html#SECTION00051000000000000000> tixTList - The Tix Tabular Listbox Widget<A NAME=31> </A></A>
|
||||
<LI> <A NAME=tex2html744 HREF=subsection3_5_2.html#SECTION00052000000000000000> Display Items<A NAME=32> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html745 HREF=subsubsection3_5_2_1.html#SECTION00052100000000000000> Advantages of Display Items<A NAME=321> </A></A>
|
||||
<LI> <A NAME=tex2html746 HREF=subsubsection3_5_2_2.html#SECTION00052200000000000000> Display Items and Display Styles<A NAME=322> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html747 HREF=subsection3_5_3.html#SECTION00053000000000000000> Creating Display Items in the TixTList Widget<A NAME=33> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html748 HREF=subsubsection3_5_3_1.html#SECTION00053100000000000000> Creating Display Items<A NAME=331> </A></A>
|
||||
<LI> <A NAME=tex2html749 HREF=subsubsection3_5_3_2.html#SECTION00053200000000000000> Setting the Styles of the Display Items<A NAME=332> </A></A>
|
||||
<LI> <A NAME=tex2html750 HREF=subsubsection3_5_3_3.html#SECTION00053300000000000000> Configuring and Deleting the Items<A NAME=333> </A></A>
|
||||
<LI> <A NAME=tex2html751 HREF=subsubsection3_5_3_4.html#SECTION00053400000000000000> Choosing the Orientation and Number of Rows or Columns<A NAME=334> </A></A>
|
||||
<LI> <A NAME=tex2html752 HREF=subsubsection3_5_3_5.html#SECTION00053500000000000000> Event Handling<A NAME=335> </A></A>
|
||||
<LI> <A NAME=tex2html753 HREF=subsubsection3_5_3_6.html#SECTION00053600000000000000> Selection<A NAME=336> </A></A>
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
30
docs/html/TixBook/section3_6.html
Normal file
30
docs/html/TixBook/section3_6.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<HEAD>
|
||||
<TITLE> Hierarchical Listbox<A NAME=4> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html885 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html883 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html877 HREF=subsubsection3_5_3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html887 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html886 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<B>Up:</B> <A NAME=tex2html884 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html878 HREF=subsubsection3_5_3_6.html> Selection</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00060000000000000000> Hierarchical Listbox<A NAME=4> </A></A></H1>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html888 HREF=subsection3_6_1.html#SECTION00061000000000000000> TixHList - The Tix Hierarchical Listbox Widget<A NAME=41> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html889 HREF=subsubsection3_6_1_1.html#SECTION00061100000000000000> Creating a Hierarchical List<A NAME=411> </A></A>
|
||||
<LI> <A NAME=tex2html890 HREF=subsubsection3_6_1_2.html#SECTION00061200000000000000> Creating Entries in a HList Widget<A NAME=412> </A></A>
|
||||
<LI> <A NAME=tex2html891 HREF=subsubsection3_6_1_3.html#SECTION00061300000000000000> Controlling the Layout of the Entries<A NAME=413> </A></A>
|
||||
<LI> <A NAME=tex2html892 HREF=subsubsection3_6_1_4.html#SECTION00061400000000000000> Handling the Selection and User Event<A NAME=414> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html893 HREF=subsection3_6_2.html#SECTION00062000000000000000> Creating Collapsible Tree Structures with TixTree<A NAME=42> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
35
docs/html/TixBook/section3_7.html
Normal file
35
docs/html/TixBook/section3_7.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<HEAD>
|
||||
<TITLE> Selecting Files and Directories<A NAME=5> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html968 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html966 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html960 HREF=subsection3_6_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html970 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html969 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B>Up:</B> <A NAME=tex2html967 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html961 HREF=subsection3_6_2.html> Creating Collapsible Tree </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00070000000000000000> Selecting Files and Directories<A NAME=5> </A></A></H1>
|
||||
<P>
|
||||
One task that an application has to perform frequently is to ask the user
|
||||
to select files or directories. To select files, you can use the Tix <em>File Selection Widgets</em>: TixFileSelectDialog and
|
||||
TixExFileSelectDialog. To select directories, you can use the Tix <em>Directory Selection Widgets</em>: TixDirList and TixDirTree.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html971 HREF=subsection3_7_1.html#SECTION00071000000000000000> File Selection Dialog Widgets<A NAME=51> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html972 HREF=subsubsection3_7_1_1.html#SECTION00071100000000000000> Using the TixFileSelectDialog Widget<A NAME=511> </A></A>
|
||||
<LI> <A NAME=tex2html973 HREF=subsubsection3_7_1_2.html#SECTION00071200000000000000> The Subwidget in the TixFileSelectDialog<A NAME=512> </A></A>
|
||||
<LI> <A NAME=tex2html974 HREF=subsubsection3_7_1_3.html#SECTION00071300000000000000> The TixExFileSelectDialog Widget<A NAME=513> </A></A>
|
||||
<LI> <A NAME=tex2html975 HREF=subsubsection3_7_1_4.html#SECTION00071400000000000000> Specifying File Types for TixExFileSelectDialog<A NAME=514> </A></A>
|
||||
<LI> <A NAME=tex2html976 HREF=subsubsectionstar3_7_1_5.html#SECTION00071500000000000000> 5.1.5 The <b><tt>tix filedialog</tt></b> Command<A NAME=515> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html977 HREF=subsection3_7_2.html#SECTION00072000000000000000> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
59
docs/html/TixBook/section3_8.html
Normal file
59
docs/html/TixBook/section3_8.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<HEAD>
|
||||
<TITLE> Tix Object Oriented Programming<A NAME=6> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1062 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1060 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1056 HREF=subsection3_7_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1064 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1063 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B>Up:</B> <A NAME=tex2html1061 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1057 HREF=subsection3_7_2.html> Selecting Directories with </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00080000000000000000> Tix Object Oriented Programming<A NAME=6> </A></A></H1>
|
||||
<P>
|
||||
<em>This chapter is intended for experienced programmers who want to
|
||||
create new Tix widgets. If you just want use the Tix widgets in your
|
||||
applications, you can skip this chapter.</em>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1065 HREF=subsection3_8_1.html#SECTION00081000000000000000> Introduction to Tix Object Oriented Programming<A NAME=61> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1066 HREF=subsubsection3_8_1_1.html#SECTION00081100000000000000> Widget Classes and Widget Instances<A NAME=611> </A></A>
|
||||
<LI> <A NAME=tex2html1067 HREF=subsubsection3_8_1_2.html#SECTION00081200000000000000> What is in a Widget Instance<A NAME=612> </A></A>
|
||||
<LI> <A NAME=tex2html1068 HREF=subsubsectionstar3_8_1_3.html#SECTION00081300000000000000> Variables<A NAME=6121> </A></A>
|
||||
<LI> <A NAME=tex2html1069 HREF=subsubsectionstar3_8_1_4.html#SECTION00081400000000000000> Methods<A NAME=6122> </A></A>
|
||||
<LI> <A NAME=tex2html1070 HREF=subsubsectionstar3_8_1_5.html#SECTION00081500000000000000> Component Widgets<A NAME=6123> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html1071 HREF=subsection3_8_2.html#SECTION00082000000000000000> Widget Class Declaration<A NAME=62> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1072 HREF=subsubsection3_8_2_1.html#SECTION00082100000000000000> Using the tixWidgetClass Command<A NAME=621> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html1073 HREF=subsection3_8_3.html#SECTION00083000000000000000> Writing Methods<A NAME=63> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1074 HREF=subsubsection3_8_3_1.html#SECTION00083100000000000000> Declaring Public Methods<A NAME=631> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html1075 HREF=subsection3_8_4.html#SECTION00084000000000000000> Standard Initialization Methods<A NAME=64> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1076 HREF=subsubsection3_8_4_1.html#SECTION00084100000000000000> The InitWidgetRec Method<A NAME=641> </A></A>
|
||||
<LI> <A NAME=tex2html1077 HREF=subsubsectionstar3_8_4_2.html#SECTION00084200000000000000> Chaining Methods<A NAME=6411> </A></A>
|
||||
<LI> <A NAME=tex2html1078 HREF=subsubsectionstar3_8_4_3.html#SECTION00084300000000000000> The tixChainMethod call<A NAME=6412> </A></A>
|
||||
<LI> <A NAME=tex2html1079 HREF=subsubsection3_8_4_4.html#SECTION00084400000000000000> The ConstructWidget Method<A NAME=642> </A></A>
|
||||
<LI> <A NAME=tex2html1080 HREF=subsubsection3_8_4_5.html#SECTION00084500000000000000> The SetBindings Method<A NAME=643> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html1081 HREF=subsection3_8_5.html#SECTION00085000000000000000> Declaring and Using Variables<A NAME=65> </A></A>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1082 HREF=subsubsection3_8_5_1.html#SECTION00085100000000000000> Initialization of Public Variables<A NAME=651> </A></A>
|
||||
<LI> <A NAME=tex2html1083 HREF=subsubsectionstar3_8_5_2.html#SECTION00085200000000000000> Type Checker<A NAME=6511> </A></A>
|
||||
<LI> <A NAME=tex2html1084 HREF=subsubsection3_8_5_3.html#SECTION00085300000000000000> Public Variable Configuration Methods<A NAME=652> </A></A>
|
||||
<LI> <A NAME=tex2html1085 HREF=subsubsectionstar3_8_5_4.html#SECTION00085400000000000000> Configuration Methods and Public Variable Initialization<A NAME=6521> </A></A>
|
||||
</UL>
|
||||
<LI> <A NAME=tex2html1086 HREF=subsection3_8_6.html#SECTION00086000000000000000> Summary of Widget Instance Initialization<A NAME=66> </A></A>
|
||||
<LI> <A NAME=tex2html1087 HREF=subsection3_8_7.html#SECTION00087000000000000000> Loading the New Classes<A NAME=67> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
25
docs/html/TixBook/sectionstar3_2.html
Normal file
25
docs/html/TixBook/sectionstar3_2.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<HEAD>
|
||||
<TITLE> Preface</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html155 HREF=subsectionstar3_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html153 HREF=TixBook.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html147 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html157 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html156 HREF=subsectionstar3_2_1.html> About This Manual</A>
|
||||
<B>Up:</B> <A NAME=tex2html154 HREF=TixBook.html>Tix Programming Guide</A>
|
||||
<B> Previous:</B> <A NAME=tex2html148 HREF=tableofcontents3_1.html>Contents</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H1><A NAME=SECTION00020000000000000000> Preface</A></H1>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html158 HREF=subsectionstar3_2_1.html#SECTION00021000000000000000> About This Manual<A NAME=01> </A></A>
|
||||
<LI> <A NAME=tex2html159 HREF=subsectionstar3_2_2.html#SECTION00022000000000000000> About This Document<A NAME=02> </A></A>
|
||||
<LI> <A NAME=tex2html160 HREF=subsectionstar3_2_3.html#SECTION00023000000000000000> Organization of This Manual<A NAME=03> </A><A NAME=04> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
24
docs/html/TixBook/subsection3_3_1.html
Normal file
24
docs/html/TixBook/subsection3_3_1.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<HEAD>
|
||||
<TITLE> What is Tix<A NAME=11> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html240 HREF=subsubsection3_3_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html238 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html232 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html242 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html241 HREF=subsubsection3_3_1_1.html> Tix for Application </A>
|
||||
<B>Up:</B> <A NAME=tex2html239 HREF=section3_3.html> Introduction</A>
|
||||
<B> Previous:</B> <A NAME=tex2html233 HREF=section3_3.html> Introduction</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00031000000000000000> What is Tix<A NAME=11> </A></A></H2>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html243 HREF=subsubsection3_3_1_1.html#SECTION00031100000000000000> Tix for Application Programmers<A NAME=111> </A></A>
|
||||
<LI> <A NAME=tex2html244 HREF=subsubsection3_3_1_2.html#SECTION00031200000000000000> Tix for Widget Developers<A NAME=112> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
36
docs/html/TixBook/subsection3_3_2.html
Normal file
36
docs/html/TixBook/subsection3_3_2.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<HEAD>
|
||||
<TITLE> Getting Started: the TixControl Widget<A NAME=12> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html273 HREF=subsubsection3_3_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html271 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html265 HREF=subsubsection3_3_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html275 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html274 HREF=subsubsection3_3_2_1.html> Creating a TixControl </A>
|
||||
<B>Up:</B> <A NAME=tex2html272 HREF=section3_3.html> Introduction</A>
|
||||
<B> Previous:</B> <A NAME=tex2html266 HREF=subsubsection3_3_1_2.html> Tix for Widget </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00032000000000000000> Getting Started: the TixControl Widget<A NAME=12> </A></A></H2>
|
||||
<P>
|
||||
<em>Pre-requisites: you should be familiar with Tk widgets and
|
||||
programming, or read the Tk book along with this book</em>
|
||||
<P>
|
||||
Before delving into the deep philosophy of the Tix widgets, let us
|
||||
first have a quick example to demonstrate the usefulness and
|
||||
convenience of an Tix widget: the TixControl is basically an entry
|
||||
widget that displays a value. Next to the entry, there are two up
|
||||
and down arrow buttons for you to adjust the value inside the entry
|
||||
widget.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html276 HREF=subsubsection3_3_2_1.html#SECTION00032100000000000000> Creating a TixControl Widget<A NAME=121> </A></A>
|
||||
<LI> <A NAME=tex2html277 HREF=subsubsection3_3_2_2.html#SECTION00032200000000000000> Accessing The Value of a TixControl Widget<A NAME=122> </A></A>
|
||||
<LI> <A NAME=tex2html278 HREF=subsubsectionstar3_3_2_3.html#SECTION00032300000000000000> Disabling Callbacks Temporarily<A NAME=1221> </A></A>
|
||||
<LI> <A NAME=tex2html279 HREF=subsubsection3_3_2_4.html#SECTION00032400000000000000> Validating User Inputs<A NAME=123> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
29
docs/html/TixBook/subsection3_3_3.html
Normal file
29
docs/html/TixBook/subsection3_3_3.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<HEAD>
|
||||
<TITLE> Accessing The Components Inside Mega Widgets<A NAME=13> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html330 HREF=subsubsection3_3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html328 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html322 HREF=subsubsection3_3_2_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html332 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html331 HREF=subsubsection3_3_3_1.html> Subwidgets</A>
|
||||
<B>Up:</B> <A NAME=tex2html329 HREF=section3_3.html> Introduction</A>
|
||||
<B> Previous:</B> <A NAME=tex2html323 HREF=subsubsection3_3_2_4.html> Validating User Inputs</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00033000000000000000> Accessing The Components Inside Mega Widgets<A NAME=13> </A></A></H2>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html333 HREF=subsubsection3_3_3_1.html#SECTION00033100000000000000> Subwidgets<A NAME=131> </A></A>
|
||||
<LI> <A NAME=tex2html334 HREF=subsubsection3_3_3_2.html#SECTION00033200000000000000> Subwidget Names<A NAME=132> </A></A>
|
||||
<LI> <A NAME=tex2html335 HREF=subsubsection3_3_3_3.html#SECTION00033300000000000000> The <tt>subwidget</tt> Method<A NAME=133> </A></A>
|
||||
<LI> <A NAME=tex2html336 HREF=subsubsection3_3_3_4.html#SECTION00033400000000000000> Chaining the <tt>subwidget</tt> Method<A NAME=134> </A></A>
|
||||
<LI> <A NAME=tex2html337 HREF=subsubsection3_3_3_5.html#SECTION00033500000000000000> Configuring Subwidget Options Using the <tt>-options</tt> Switch<A NAME=135> </A></A>
|
||||
<LI> <A NAME=tex2html338 HREF=subsubsection3_3_3_6.html#SECTION00033600000000000000> Configuring Subwidget Options Using the Tk Option Database<A NAME=136> </A></A>
|
||||
<LI> <A NAME=tex2html339 HREF=subsubsection3_3_3_7.html#SECTION00033700000000000000> Caution: Restricted Access<A NAME=137> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
40
docs/html/TixBook/subsection3_3_4.html
Normal file
40
docs/html/TixBook/subsection3_3_4.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<HEAD>
|
||||
<TITLE> Another Tix Widget: TixComboBox<A NAME=14> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html423 HREF=subsubsection3_3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html421 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html415 HREF=subsubsection3_3_3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html425 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html424 HREF=subsubsection3_3_4_1.html> Creating a TixComboBox </A>
|
||||
<B>Up:</B> <A NAME=tex2html422 HREF=section3_3.html> Introduction</A>
|
||||
<B> Previous:</B> <A NAME=tex2html416 HREF=subsubsection3_3_3_7.html> Caution: Restricted Access</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00034000000000000000> Another Tix Widget: TixComboBox<A NAME=14> </A></A></H2>
|
||||
<P>
|
||||
The <em>TixComboBox</em> widget is very similar to the ComboBox widgets
|
||||
available in MS Windows and Motif 2.0. A TixComboBox consists of an entry
|
||||
widget and a listbox widget. Usually, the ComboBox contains a list of
|
||||
possible values for the user to select. The user may also choose an
|
||||
alternative value by typing it in the entry widget. Figure 1-8
|
||||
shows two ComboBoxes for the user to choose fonts and
|
||||
character sizes. You can see fro the figure that a listbox is popped down
|
||||
from the ComboBox for fonts for the user to choose among a list of
|
||||
possible fonts.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/combo.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html426 HREF=subsubsection3_3_4_1.html#SECTION00034100000000000000> Creating a TixComboBox Widget<A NAME=141> </A></A>
|
||||
<LI> <A NAME=tex2html427 HREF=subsubsection3_3_4_2.html#SECTION00034200000000000000> Controlling the Style of the TixComboBox<A NAME=142> </A></A>
|
||||
<LI> <A NAME=tex2html428 HREF=subsubsection3_3_4_3.html#SECTION00034300000000000000> Static Options<A NAME=143> </A></A>
|
||||
<LI> <A NAME=tex2html429 HREF=subsubsection3_3_4_4.html#SECTION00034400000000000000> Monitoring the User's Browsing Actions<A NAME=144> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
45
docs/html/TixBook/subsection3_3_5.html
Normal file
45
docs/html/TixBook/subsection3_3_5.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<HEAD>
|
||||
<TITLE> The TixSelect Widget<A NAME=15> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html478 HREF=subsubsection3_3_5_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html476 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html472 HREF=subsubsection3_3_4_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html480 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html479 HREF=subsubsection3_3_5_1.html> Creating A TixSelect </A>
|
||||
<B>Up:</B> <A NAME=tex2html477 HREF=section3_3.html> Introduction</A>
|
||||
<B> Previous:</B> <A NAME=tex2html473 HREF=subsubsection3_3_4_4.html> Monitoring the User's </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00035000000000000000> The TixSelect Widget<A NAME=15> </A></A></H2>
|
||||
<P>
|
||||
The TixSelect widget figure 1-10 provides you the same
|
||||
kind of facility that is available with the Tk <tt>radiobutton</tt> and
|
||||
<tt>checkbutton</tt> widgets. That is, TixSelect allows the user to
|
||||
select one or a few values out of many choices. However, TixSelect
|
||||
is superior because it allows you to layout the choices in much less
|
||||
space than what is required by the Tk <tt>radiobutton</tt>
|
||||
widgets. Also, TixSelect supports complicated selection
|
||||
rules. Because of these reasons, TixSelect is a primary choice for
|
||||
implementing toolbar buttons, which often have strict space
|
||||
requirements and complicated selection rules.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/select.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html481 HREF=subsubsection3_3_5_1.html#SECTION00035100000000000000> Creating A TixSelect Widget<A NAME=151> </A></A>
|
||||
<LI> <A NAME=tex2html482 HREF=subsubsectionstar3_3_5_2.html#SECTION00035200000000000000> Label and Orientation<A NAME=1511> </A></A>
|
||||
<LI> <A NAME=tex2html483 HREF=subsubsectionstar3_3_5_3.html#SECTION00035300000000000000> Creating the Button Subwidgets and Configuring
|
||||
Their Appearance<A NAME=1512> </A></A>
|
||||
<LI> <A NAME=tex2html484 HREF=subsubsectionstar3_3_5_4.html#SECTION00035400000000000000> Accessing the Button Subwidgets<A NAME=1513> </A></A>
|
||||
<LI> <A NAME=tex2html485 HREF=subsubsection3_3_5_5.html#SECTION00035500000000000000> Specifying Selection Rules<A NAME=152> </A></A>
|
||||
<LI> <A NAME=tex2html486 HREF=subsubsection3_3_5_6.html#SECTION00035600000000000000> Accessing the Value of a TixSelect Widget<A NAME=153> </A></A>
|
||||
<LI> <A NAME=tex2html487 HREF=subsubsection3_3_5_7.html#SECTION00035700000000000000> Specifying Complex Selection Rules<A NAME=154> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
44
docs/html/TixBook/subsection3_4_1.html
Normal file
44
docs/html/TixBook/subsection3_4_1.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<HEAD>
|
||||
<TITLE> TixNoteBook<A NAME=21> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html595 HREF=subsubsection3_4_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html593 HREF=section3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html587 HREF=section3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html597 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html596 HREF=subsubsection3_4_1_1.html> Adding Pages to </A>
|
||||
<B>Up:</B> <A NAME=tex2html594 HREF=section3_4.html> Container Widgets</A>
|
||||
<B> Previous:</B> <A NAME=tex2html588 HREF=section3_4.html> Container Widgets</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00041000000000000000> TixNoteBook<A NAME=21> </A></A></H2>
|
||||
<P>
|
||||
When your need to put a lot of information into your interface, you
|
||||
may find out that your window has to grow intolerably big in order
|
||||
to hold all the information. Having a window that's 10000
|
||||
pixels wide and 5000 pixels high doesn't seem to be the perfect
|
||||
solution. Of course, you can ``chop up'' your big window into a set
|
||||
of smaller dialog boxes, but the user will most likely find it
|
||||
impossible to manage 20 different dialog boxes on their desktop.
|
||||
<P>
|
||||
The TixNoteBook (fig 2-1) widget comes into rescue. It
|
||||
allows you to pack a large interface into manageable ``pages'' using a
|
||||
notebook metaphor: it contains multiple pages with anything you want on
|
||||
them, displays one at a time, and attaches a tab to each page so the user
|
||||
can bring it forward with a single click on the tab.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/container/notebook.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html598 HREF=subsubsection3_4_1_1.html#SECTION00041100000000000000> Adding Pages to a TixNoteBook<A NAME=211> </A></A>
|
||||
<LI> <A NAME=tex2html599 HREF=subsubsection3_4_1_2.html#SECTION00041200000000000000> Keyboard Accelerators<A NAME=212> </A></A>
|
||||
<LI> <A NAME=tex2html600 HREF=subsubsection3_4_1_3.html#SECTION00041300000000000000> Delaying the Creation of New Pages<A NAME=213> </A></A>
|
||||
<LI> <A NAME=tex2html601 HREF=subsubsection3_4_1_4.html#SECTION00041400000000000000> Changing Page Tabs and Deleting Pages<A NAME=214> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
40
docs/html/TixBook/subsection3_4_2.html
Normal file
40
docs/html/TixBook/subsection3_4_2.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<HEAD>
|
||||
<TITLE> PanedWindow<A NAME=22> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html652 HREF=subsubsection3_4_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html650 HREF=section3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html644 HREF=subsubsection3_4_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html654 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html653 HREF=subsubsection3_4_2_1.html> Adding Panes Inside </A>
|
||||
<B>Up:</B> <A NAME=tex2html651 HREF=section3_4.html> Container Widgets</A>
|
||||
<B> Previous:</B> <A NAME=tex2html645 HREF=subsubsection3_4_1_4.html> Changing Page Tabs </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00042000000000000000> PanedWindow<A NAME=22> </A></A></H2>
|
||||
<P>
|
||||
The <em>TixPanedWindow</em> widget arranges arranges its subwidgets in
|
||||
non-overlapping panes. As we can see in figure 2-4, the
|
||||
PanedWindow widget puts a resize handle between the panes for the
|
||||
user to manipulate the sizes of the panes interactively. The panes
|
||||
can be arranged either vertically (figure 2-4) or
|
||||
horizontally (2-4).
|
||||
<P>Each individual pane may have upper and lower limits of its
|
||||
size. The user changes the sizes of the panes by dragging the resize
|
||||
handle between two panes.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/container/pane_vert.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/container/pane_horz.gif"><BR CLEAR=LEFT><CENTER>(Figure 2-4) The TixPane Widget<A NAME=24> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html655 HREF=subsubsection3_4_2_1.html#SECTION00042100000000000000> Adding Panes Inside a TixPanedWindow Widget<A NAME=221> </A></A>
|
||||
<LI> <A NAME=tex2html656 HREF=subsubsection3_4_2_2.html#SECTION00042200000000000000> Putting Widgets Inside the Panes<A NAME=222> </A></A>
|
||||
<LI> <A NAME=tex2html657 HREF=subsubsection3_4_2_3.html#SECTION00042300000000000000> Setting the Order of the Panes<A NAME=223> </A></A>
|
||||
<LI> <A NAME=tex2html658 HREF=subsubsection3_4_2_4.html#SECTION00042400000000000000> Changing the Sizes of the Panes<A NAME=224> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
39
docs/html/TixBook/subsection3_4_3.html
Normal file
39
docs/html/TixBook/subsection3_4_3.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<HEAD>
|
||||
<TITLE> The Family of Scrolled Widgets<A NAME=23> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html707 HREF=subsubsection3_4_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html705 HREF=section3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html701 HREF=subsubsection3_4_2_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html709 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html708 HREF=subsubsection3_4_3_1.html> The Scrolled Listbox </A>
|
||||
<B>Up:</B> <A NAME=tex2html706 HREF=section3_4.html> Container Widgets</A>
|
||||
<B> Previous:</B> <A NAME=tex2html702 HREF=subsubsection3_4_2_4.html> Changing the Sizes </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00043000000000000000> The Family of Scrolled Widgets<A NAME=23> </A></A></H2>
|
||||
<P>
|
||||
With plain Tcl/Tk, the widgets do not automatically come with
|
||||
scrollbars. If you want to use scrollbars with the text, canvas or
|
||||
listbox widgets, you will need to create scrollbars separately and
|
||||
attach them to the widgets. This can be a lot of hassle because you
|
||||
would almost always need scrollbars for these widgets. Sometimes you
|
||||
will wonder why you need to write the same boring code again and
|
||||
again just to get the scrollbars to working.
|
||||
<P>The Tix scrolled widgets are here to make your life easier. With a
|
||||
single command such as <tt>tixScrolledListBox</tt> or <tt>tixScrolledText</tt>, you can create a listbox or text widget that comes
|
||||
automatically with scrollbars attached.
|
||||
<P>Another advantage of the Tix scrolled widgets is that you can
|
||||
specify their scrolling policy so that the scrollbars appear only
|
||||
when they are needed. This feature is especially useful if you are
|
||||
displaying a lot of widgets and running out of screen real estate.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html710 HREF=subsubsection3_4_3_1.html#SECTION00043100000000000000> The Scrolled Listbox Widget<A NAME=231> </A></A>
|
||||
<LI> <A NAME=tex2html711 HREF=subsubsection3_4_3_2.html#SECTION00043200000000000000> Other Scrolled Widgets<A NAME=232> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
46
docs/html/TixBook/subsection3_5_1.html
Normal file
46
docs/html/TixBook/subsection3_5_1.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<HEAD>
|
||||
<TITLE> tixTList - The Tix Tabular Listbox Widget<A NAME=31> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html762 HREF=subsection3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html760 HREF=section3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html754 HREF=section3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html764 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html763 HREF=subsection3_5_2.html> Display Items</A>
|
||||
<B>Up:</B> <A NAME=tex2html761 HREF=section3_5.html> Tabular Listbox and </A>
|
||||
<B> Previous:</B> <A NAME=tex2html755 HREF=section3_5.html> Tabular Listbox and </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00051000000000000000> tixTList - The Tix Tabular Listbox Widget<A NAME=31> </A></A></H2>
|
||||
<P>
|
||||
<em>TixTList</em> is the Tabular Listbox Widget. It displays a list of
|
||||
items in a tabular format. For example the TixTList widget in figure
|
||||
3-1 displays files in a directory in rows and columns.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/tlist/tlist.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P><blockquote> <P><CENTER><IMG SRC="../gif/tix/tlist/joe.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
TixTList does all what the standard Tk listbox widget can do, i.e,
|
||||
it displays a list of items. However, TixTList is superior to the
|
||||
listbox widget is many respects. First, TixTList allows you to
|
||||
display the items in a two dimensional format. This way, you can
|
||||
display more items at a time. Usually, the user can locate the
|
||||
desired items much faster in a two dimensional list than the one
|
||||
dimensional list displayed by the Tk listbox widget.
|
||||
<P>
|
||||
In addition, while the Tk listbox widget can only display text items,
|
||||
the TixTList widget can display a multitude of types of items: text,
|
||||
images and widgets. Also, while you can use only one font and one color
|
||||
in a listbox widget, you can use many different fonts and colors in a
|
||||
TixTList widget. In figure 3-1, we use graphical images
|
||||
inside a tixTList widget to represent file objects. In figure 3-2
|
||||
, we display the names of all employees of a hypothetical
|
||||
company. Notice the use of a bold font to highlight all employees whose
|
||||
first name is Joe. <P><HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
59
docs/html/TixBook/subsection3_5_2.html
Normal file
59
docs/html/TixBook/subsection3_5_2.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<HEAD>
|
||||
<TITLE> Display Items<A NAME=32> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html773 HREF=subsubsection3_5_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html771 HREF=section3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html765 HREF=subsection3_5_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html775 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html774 HREF=subsubsection3_5_2_1.html> Advantages of Display </A>
|
||||
<B>Up:</B> <A NAME=tex2html772 HREF=section3_5.html> Tabular Listbox and </A>
|
||||
<B> Previous:</B> <A NAME=tex2html766 HREF=subsection3_5_1.html> tixTList - The </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00052000000000000000> Display Items<A NAME=32> </A></A></H2>
|
||||
<P>
|
||||
Before we rush to discuss how to create the items inside a TixTList
|
||||
widget, let's first spend some time on a very important topic about
|
||||
the Tix library: the repationship between the display items and
|
||||
their host widgets.
|
||||
<P>
|
||||
We can better define the terms by taking a quick preview of the
|
||||
TixHList widget, which will be covered in details in the next
|
||||
chapter. Let's compare the items displayed on the two widgets in
|
||||
figure 3-3. If we take a close look at the item
|
||||
that shows the <tt>usr</tt> directory in the TixTList widget on the left
|
||||
versus the TixHList widget on the right, we can see that this item
|
||||
appears exactly the same on both widgets.
|
||||
<P>
|
||||
If fact, all the items in these two widgets are of the <em>same</em> type:
|
||||
they all display an image next to a textual name. The only difference
|
||||
between these two widgets is how these items are arranged. The TixTList
|
||||
widget arranges the items in rows and columns, while the TixHList widget
|
||||
arranges the items in a hierachical format.
|
||||
<P>
|
||||
With this observation in mind, we can see a separation of tasks
|
||||
berween the widgets and the items they display. We call the TixHList
|
||||
and TixTList widgets in figure 3-3 <em>host
|
||||
widgets</em>: their task is to arrange the items according to their
|
||||
particular rules. However, they don't really care what these items
|
||||
display; they just treat the items as rectangle boxes. In contrast,
|
||||
these items, which are called <em>display items</em> in Tix
|
||||
terminology, controls the visual information they display, such as
|
||||
the images, text strings, colors, fonts, etc. However, they don't
|
||||
really care where on the host widget they will appear.
|
||||
<P>
|
||||
<blockquote> <P><P>
|
||||
<P><CENTER><IMG SRC="../gif/tix/tlist/widgets.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html776 HREF=subsubsection3_5_2_1.html#SECTION00052100000000000000> Advantages of Display Items<A NAME=321> </A></A>
|
||||
<LI> <A NAME=tex2html777 HREF=subsubsection3_5_2_2.html#SECTION00052200000000000000> Display Items and Display Styles<A NAME=322> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
28
docs/html/TixBook/subsection3_5_3.html
Normal file
28
docs/html/TixBook/subsection3_5_3.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating Display Items in the TixTList Widget<A NAME=33> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html804 HREF=subsubsection3_5_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html802 HREF=section3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html798 HREF=subsubsection3_5_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html806 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html805 HREF=subsubsection3_5_3_1.html> Creating Display Items</A>
|
||||
<B>Up:</B> <A NAME=tex2html803 HREF=section3_5.html> Tabular Listbox and </A>
|
||||
<B> Previous:</B> <A NAME=tex2html799 HREF=subsubsection3_5_2_2.html> Display Items and </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00053000000000000000> Creating Display Items in the TixTList Widget<A NAME=33> </A></A></H2>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html807 HREF=subsubsection3_5_3_1.html#SECTION00053100000000000000> Creating Display Items<A NAME=331> </A></A>
|
||||
<LI> <A NAME=tex2html808 HREF=subsubsection3_5_3_2.html#SECTION00053200000000000000> Setting the Styles of the Display Items<A NAME=332> </A></A>
|
||||
<LI> <A NAME=tex2html809 HREF=subsubsection3_5_3_3.html#SECTION00053300000000000000> Configuring and Deleting the Items<A NAME=333> </A></A>
|
||||
<LI> <A NAME=tex2html810 HREF=subsubsection3_5_3_4.html#SECTION00053400000000000000> Choosing the Orientation and Number of Rows or Columns<A NAME=334> </A></A>
|
||||
<LI> <A NAME=tex2html811 HREF=subsubsection3_5_3_5.html#SECTION00053500000000000000> Event Handling<A NAME=335> </A></A>
|
||||
<LI> <A NAME=tex2html812 HREF=subsubsection3_5_3_6.html#SECTION00053600000000000000> Selection<A NAME=336> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
39
docs/html/TixBook/subsection3_6_1.html
Normal file
39
docs/html/TixBook/subsection3_6_1.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<HEAD>
|
||||
<TITLE> TixHList - The Tix Hierarchical Listbox Widget<A NAME=41> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html902 HREF=subsubsection3_6_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html900 HREF=section3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html894 HREF=section3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html904 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html903 HREF=subsubsection3_6_1_1.html> Creating a Hierarchical </A>
|
||||
<B>Up:</B> <A NAME=tex2html901 HREF=section3_6.html> Hierarchical Listbox</A>
|
||||
<B> Previous:</B> <A NAME=tex2html895 HREF=section3_6.html> Hierarchical Listbox</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00061000000000000000> TixHList - The Tix Hierarchical Listbox Widget<A NAME=41> </A></A></H2>
|
||||
<P>
|
||||
<em>TixHList</em> is the Tix Hierarchical Listbox Widget. You can use it to
|
||||
display any data that have a hierarchical structure. For example, the
|
||||
HList widget in figure 4-1 displays a Unix file system
|
||||
directory tree; the HList widget in figure 4-1 displays the
|
||||
corporate hierarchy of a hypothetical company. As shown in these two
|
||||
figures, the entries inside the TixHList widget are indented can be
|
||||
optionally connected by branch lines according to their positions in the
|
||||
hierarchy.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/hlist/dirtree.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/hlist/hlist1.gif"><BR CLEAR=LEFT><CENTER>(Figure 4-1) Examples of the TixHList Widget<A NAME=41> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html905 HREF=subsubsection3_6_1_1.html#SECTION00061100000000000000> Creating a Hierarchical List<A NAME=411> </A></A>
|
||||
<LI> <A NAME=tex2html906 HREF=subsubsection3_6_1_2.html#SECTION00061200000000000000> Creating Entries in a HList Widget<A NAME=412> </A></A>
|
||||
<LI> <A NAME=tex2html907 HREF=subsubsection3_6_1_3.html#SECTION00061300000000000000> Controlling the Layout of the Entries<A NAME=413> </A></A>
|
||||
<LI> <A NAME=tex2html908 HREF=subsubsection3_6_1_4.html#SECTION00061400000000000000> Handling the Selection and User Event<A NAME=414> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
72
docs/html/TixBook/subsection3_6_2.html
Normal file
72
docs/html/TixBook/subsection3_6_2.html
Normal file
@@ -0,0 +1,72 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating Collapsible Tree Structures with TixTree<A NAME=42> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html957 HREF=section3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html955 HREF=section3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html951 HREF=subsubsection3_6_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html959 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html958 HREF=section3_7.html> Selecting Files and </A>
|
||||
<B>Up:</B> <A NAME=tex2html956 HREF=section3_6.html> Hierarchical Listbox</A>
|
||||
<B> Previous:</B> <A NAME=tex2html952 HREF=subsubsection3_6_1_4.html> Handling the Selection </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00062000000000000000> Creating Collapsible Tree Structures with TixTree<A NAME=42> </A></A></H2>
|
||||
<P>
|
||||
The TixTree widget is based on the TixScrolledHList widget; you can
|
||||
use it to create a collapsible hierarchical structure so that the
|
||||
user can conveniently navigate through a large number of list
|
||||
entries. As shown in figure 4-7, the TixTree puts
|
||||
the little ``<tt>+</tt>'' and ``<tt>-</tt>'' icons next to the branches of
|
||||
an HList entry that has descendants. These two icons are knows as
|
||||
the open and close icons, respectively. When the user presses the
|
||||
open icon next to an entry, its immediate children of an entry will
|
||||
be displayed. Conversely, when the user presses the close icon, the
|
||||
entry's children will become hidden.
|
||||
<P>
|
||||
Program 4-6 shows how to create a collapsible tree. We
|
||||
first create a TixTree widget. Then we add the entries in your
|
||||
hierarchical structure into its <tt>hlist</tt> subwidget using the add
|
||||
method of this subwidget. When we are finished with adding the entries,
|
||||
we just call the <tt>autosetmode</tt> method of the TixTree widget, which
|
||||
will automatically adds the open and close icons next to the entries who
|
||||
have children.
|
||||
<P>
|
||||
<P><blockquote> <P><tt> set folder [tix getimage folder]<BR>
|
||||
tixTree .tree -command Command -options {<BR>
|
||||
hlist.separator /<BR>
|
||||
hlist.itemType imagetext<BR>
|
||||
hlist.drawBranch true<BR>
|
||||
hlist.indent 18<BR>
|
||||
}<BR>
|
||||
pack .tree -expand yes -fill both<BR>
|
||||
set hlist [.tree subwidget hlist]<BR>
|
||||
<BR>
|
||||
foreach directory {/ /usr /usr/bin /usr/local /etc /etc/rc.d} {<BR>
|
||||
$hlist add $directory -image $folder -text $directory<BR>
|
||||
}<BR>
|
||||
.tree autosetmode<BR>
|
||||
<BR>
|
||||
proc Command {entry} {<BR>
|
||||
puts "you have selected $entry"<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 4-6) Creating a Collapsible Hierarchy<A NAME=46> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<blockquote> <P>
|
||||
<P><CENTER><IMG SRC="../gif/tix/hlist/hlist_ex3.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
Note that in program 4-6 we use the <tt>-command</tt> option of the TixTree
|
||||
widget, not the <tt>-command</tt> option of its <tt>hlist</tt> subwidget. This
|
||||
is because the TixTree actually used the <tt>-command</tt> option of its
|
||||
<tt>hlist</tt> subwidget to process some low-level events. In general, if
|
||||
both a mega-widget and its subwidget have the options of the same name,
|
||||
you would always use the option that belongs to the mega-widget.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
41
docs/html/TixBook/subsection3_7_1.html
Normal file
41
docs/html/TixBook/subsection3_7_1.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<HEAD>
|
||||
<TITLE> File Selection Dialog Widgets<A NAME=51> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html986 HREF=subsubsection3_7_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html984 HREF=section3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html978 HREF=section3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html988 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html987 HREF=subsubsection3_7_1_1.html> Using the TixFileSelectDialog </A>
|
||||
<B>Up:</B> <A NAME=tex2html985 HREF=section3_7.html> Selecting Files and </A>
|
||||
<B> Previous:</B> <A NAME=tex2html979 HREF=section3_7.html> Selecting Files and </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00071000000000000000> File Selection Dialog Widgets<A NAME=51> </A></A></H2>
|
||||
<P>
|
||||
There are two file dialog widgets inside Tix: the
|
||||
TixFileSelectDialog (figure 5-2) is similar to the
|
||||
FileSelectionDialog widget in Motif; TixExFileSelectDialog (figure
|
||||
5-3) looks like its conunterpart in MS Windows. Both
|
||||
widgets let the user navigate through the file system directories
|
||||
and select a file.
|
||||
<P>
|
||||
One advanced feature of both types of file selection boxes is they use
|
||||
ComboBoxes to store the files, directories and patterns the user has
|
||||
selected in the past. If the user wants to select the same files again,
|
||||
he can simply open the ComboBoxes and click on his past inputs. This
|
||||
saves a lot of keystrokes and is especially useful when the user needs to
|
||||
switch among several files or directories.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html989 HREF=subsubsection3_7_1_1.html#SECTION00071100000000000000> Using the TixFileSelectDialog Widget<A NAME=511> </A></A>
|
||||
<LI> <A NAME=tex2html990 HREF=subsubsection3_7_1_2.html#SECTION00071200000000000000> The Subwidget in the TixFileSelectDialog<A NAME=512> </A></A>
|
||||
<LI> <A NAME=tex2html991 HREF=subsubsection3_7_1_3.html#SECTION00071300000000000000> The TixExFileSelectDialog Widget<A NAME=513> </A></A>
|
||||
<LI> <A NAME=tex2html992 HREF=subsubsection3_7_1_4.html#SECTION00071400000000000000> Specifying File Types for TixExFileSelectDialog<A NAME=514> </A></A>
|
||||
<LI> <A NAME=tex2html993 HREF=subsubsectionstar3_7_1_5.html#SECTION00071500000000000000> 5.1.5 The <b><tt>tix filedialog</tt></b> Command<A NAME=515> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
53
docs/html/TixBook/subsection3_7_2.html
Normal file
53
docs/html/TixBook/subsection3_7_2.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HEAD>
|
||||
<TITLE> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52> </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> </A><H2><A NAME=SECTION00072000000000000000> Selecting Directories with the TixDirTree and TixDirList Widgets<A NAME=52> </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 "selectDir" -browsecmd "selectDir"<BR>
|
||||
pack .d<BR>
|
||||
<BR>
|
||||
proc selectDir {dir} {<BR>
|
||||
puts "now you select $dir"<BR>
|
||||
}</tt>
|
||||
</blockquote>
|
||||
<P><CENTER>(Figure 5-5) Using the TixDirList widget<A NAME=55> </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> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
53
docs/html/TixBook/subsection3_8_1.html
Normal file
53
docs/html/TixBook/subsection3_8_1.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HEAD>
|
||||
<TITLE> Introduction to Tix Object Oriented Programming<A NAME=61> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1096 HREF=subsubsection3_8_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1094 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1088 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1098 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1097 HREF=subsubsection3_8_1_1.html> Widget Classes and </A>
|
||||
<B>Up:</B> <A NAME=tex2html1095 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1089 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00081000000000000000> Introduction to Tix Object Oriented Programming<A NAME=61> </A></A></H2>
|
||||
<P>
|
||||
Tix comes with a simple object oriented programming (OOP) framework,
|
||||
the <em>Tix Intrinsics</em>, for writing mega-widgets. The Tix
|
||||
Intrinsics is not a general purpose OOP system and it does not
|
||||
support some features found in general purpose OOP systems such as
|
||||
<tt>[incr Tcl]</tt>. However, the Tix Intrinsics is specially designed
|
||||
for writing mega-widgets. It provides a simple and efficient
|
||||
interface for creating mega-widgets so that you can avoid the
|
||||
complexity and overheads of the general purpose OOP extensions to
|
||||
Tcl.
|
||||
<P>The hard thing about programming with mega-widgets is to make sure
|
||||
that each instance you create can handle its own activities. Events
|
||||
must be directed to the right widget, procedures must act on data
|
||||
that is internal to that widget, and users should be able to change
|
||||
the options associated with the widget. For instance, we'll show an
|
||||
arrow widget that needs to know what direction it's pointing; this
|
||||
requires each instance of the widget to have its own variable.
|
||||
<P>Furthermore, each widget should respond properly to changes
|
||||
requested by the application programmer during the program's run.
|
||||
The whole reason people use Tcl/Tk is because they can alter things
|
||||
on the fly.
|
||||
<P>The advantage of an object-oriented programming system is that you
|
||||
can easily associate a widget with its own data and procedures
|
||||
(methods). This chapter shows how to do that, and how to configure
|
||||
data both at the time the widget is initialized and later during the
|
||||
program.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1099 HREF=subsubsection3_8_1_1.html#SECTION00081100000000000000> Widget Classes and Widget Instances<A NAME=611> </A></A>
|
||||
<LI> <A NAME=tex2html1100 HREF=subsubsection3_8_1_2.html#SECTION00081200000000000000> What is in a Widget Instance<A NAME=612> </A></A>
|
||||
<LI> <A NAME=tex2html1101 HREF=subsubsectionstar3_8_1_3.html#SECTION00081300000000000000> Variables<A NAME=6121> </A></A>
|
||||
<LI> <A NAME=tex2html1102 HREF=subsubsectionstar3_8_1_4.html#SECTION00081400000000000000> Methods<A NAME=6122> </A></A>
|
||||
<LI> <A NAME=tex2html1103 HREF=subsubsectionstar3_8_1_5.html#SECTION00081500000000000000> Component Widgets<A NAME=6123> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
35
docs/html/TixBook/subsection3_8_2.html
Normal file
35
docs/html/TixBook/subsection3_8_2.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<HEAD>
|
||||
<TITLE> Widget Class Declaration<A NAME=62> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1165 HREF=subsubsection3_8_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1163 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1157 HREF=subsubsectionstar3_8_1_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1167 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1166 HREF=subsubsection3_8_2_1.html> Using the tixWidgetClass </A>
|
||||
<B>Up:</B> <A NAME=tex2html1164 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1158 HREF=subsubsectionstar3_8_1_5.html> Component Widgets</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00082000000000000000> Widget Class Declaration<A NAME=62> </A></A></H2>
|
||||
<P>
|
||||
The first step of writing a new widget class is to decide the base
|
||||
class from which the new class. Usually, if the new class does not
|
||||
share any common features with other classes, it should be derived
|
||||
from the TixPrimitive class. If it does share common features with
|
||||
other classes, then it should be derived from the appropriate base
|
||||
class. For example, if the new class support scrollbars, it should
|
||||
be derived from TixScrolledWidget; if it displays a label next to
|
||||
its ``main area'', then it should be derived from TixLabelWidget.
|
||||
<P>In the case of our new TixArrowButton class, it doesn't really share
|
||||
any common features with other classes, so we decide to use the base
|
||||
class TixPrimitive as its superclass.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1168 HREF=subsubsection3_8_2_1.html#SECTION00082100000000000000> Using the tixWidgetClass Command<A NAME=621> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
82
docs/html/TixBook/subsection3_8_3.html
Normal file
82
docs/html/TixBook/subsection3_8_3.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<HEAD>
|
||||
<TITLE> Writing Methods<A NAME=63> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1186 HREF=subsubsection3_8_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1184 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1178 HREF=subsubsection3_8_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1188 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1187 HREF=subsubsection3_8_3_1.html> Declaring Public Methods</A>
|
||||
<B>Up:</B> <A NAME=tex2html1185 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1179 HREF=subsubsection3_8_2_1.html> Using the tixWidgetClass </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00083000000000000000> Writing Methods<A NAME=63> </A></A></H2>
|
||||
<P>
|
||||
After we have declared the new widget class, we can write methods
|
||||
for this class to define its behavior. Methods are just a special
|
||||
type of TCL procedures and they are created by the <tt>proc</tt>
|
||||
command. There are, however, three requirements for methods. First,
|
||||
their names must be prefixed by the command name of their
|
||||
class. Second, they must accept at least one argument and the first
|
||||
argument that they accept must be called <tt>w</tt>. Third, the first
|
||||
command executed inside each method must be:
|
||||
<blockquote> <P><tt> upvar #0 $w data
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>For example, the following is an implementation of the invert method
|
||||
for the class TixArrowButton:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:invert {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
set curDirection $data(-direction)<BR>
|
||||
case $curDirection {<BR>
|
||||
n {<BR>
|
||||
set newDirection s<BR>
|
||||
}<BR>
|
||||
s {<BR>
|
||||
set newDirection n<BR>
|
||||
}<BR>
|
||||
# ....<BR>
|
||||
}<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
Notice that the name of the method is prefixed by the command name
|
||||
of the class (<tt>tixArrowButton</tt>). Also, the first and only
|
||||
argument that it accepts is <tt>w</tt> and the first line it executes
|
||||
is ``<tt>upvar #0 $wdata</tt>''.
|
||||
<P>
|
||||
The argument <tt>w</tt> specifies which widget instance this method
|
||||
should act upon. For example, if the user has issued the command
|
||||
<P>
|
||||
<blockquote> <P><tt> .up invert
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
on an instance <tt>.up</tt> of the class tixArrowButton, the method
|
||||
<tt>tixArrowButton:invert</tt> will be called and the argument <tt>w</tt>
|
||||
will have the value <tt>.up</tt>.
|
||||
<P>
|
||||
The <tt>invert</tt> method is used to invert the direction of the
|
||||
arrow. Therefore, it should examine the variable <tt>.up(-direction)</tt>, which stores the current direction of the instance
|
||||
<tt>.up</tt>, and modify it appropriately. It turns out that in TCL,
|
||||
the only clean way to access an array whose name is stored in a
|
||||
variable is the ``<tt>upvar #0 $wdata</tt>'' technique: essentially
|
||||
it tells the intepreter that the array data should be an alias for
|
||||
the global array whose name is stored in <tt>$w</tt>. We will soon see
|
||||
how the widget's methods use the data array.
|
||||
<P>
|
||||
Once the mysterious ``<tt>upvar #0 $wdata</tt>'' line is explained,
|
||||
it becomes clear what the rest of the <tt>tixArrowButton:invert</tt>
|
||||
method does: it examines the current direction of the arrow, which
|
||||
is stored in <tt>$data(-direction)</tt> and inverts it.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1189 HREF=subsubsection3_8_3_1.html#SECTION00083100000000000000> Declaring Public Methods<A NAME=631> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
33
docs/html/TixBook/subsection3_8_4.html
Normal file
33
docs/html/TixBook/subsection3_8_4.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<HEAD>
|
||||
<TITLE> Standard Initialization Methods<A NAME=64> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1207 HREF=subsubsection3_8_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1205 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1199 HREF=subsubsection3_8_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1209 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1208 HREF=subsubsection3_8_4_1.html> The InitWidgetRec Method</A>
|
||||
<B>Up:</B> <A NAME=tex2html1206 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1200 HREF=subsubsection3_8_3_1.html> Declaring Public Methods</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00084000000000000000> Standard Initialization Methods<A NAME=64> </A></A></H2>
|
||||
<P>
|
||||
Each new mega-widget class must supply three standard initialization
|
||||
methods. When an instance of a Tix widget is created, three
|
||||
three methods will be called to initialize this instance. The
|
||||
methods are <tt>InitWidgetRec</tt>, <tt>ConstructWidget</tt> and <tt>SetBindings</tt> and they will be called in that order. The following
|
||||
sections show how these methods can be implemented.
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1210 HREF=subsubsection3_8_4_1.html#SECTION00084100000000000000> The InitWidgetRec Method<A NAME=641> </A></A>
|
||||
<LI> <A NAME=tex2html1211 HREF=subsubsectionstar3_8_4_2.html#SECTION00084200000000000000> Chaining Methods<A NAME=6411> </A></A>
|
||||
<LI> <A NAME=tex2html1212 HREF=subsubsectionstar3_8_4_3.html#SECTION00084300000000000000> The tixChainMethod call<A NAME=6412> </A></A>
|
||||
<LI> <A NAME=tex2html1213 HREF=subsubsection3_8_4_4.html#SECTION00084400000000000000> The ConstructWidget Method<A NAME=642> </A></A>
|
||||
<LI> <A NAME=tex2html1214 HREF=subsubsection3_8_4_5.html#SECTION00084500000000000000> The SetBindings Method<A NAME=643> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
82
docs/html/TixBook/subsection3_8_5.html
Normal file
82
docs/html/TixBook/subsection3_8_5.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<HEAD>
|
||||
<TITLE> Declaring and Using Variables<A NAME=65> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1276 HREF=subsubsection3_8_5_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1274 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1268 HREF=subsubsection3_8_4_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1278 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1277 HREF=subsubsection3_8_5_1.html> Initialization of Public </A>
|
||||
<B>Up:</B> <A NAME=tex2html1275 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1269 HREF=subsubsection3_8_4_5.html> The SetBindings Method</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00085000000000000000> Declaring and Using Variables<A NAME=65> </A></A></H2>
|
||||
<P>
|
||||
The private variables of a widget class do not need to be
|
||||
declared. In fact they can be initialized and used anywhere by any
|
||||
method. Usually, however, general purpose private variables are
|
||||
initialized by the <tt>InitWidgetRec</tt> method and subwidget
|
||||
variables are initialized in the <tt>ConstructWidget</tt> method.
|
||||
<P>We have seen in the <tt>tixArrowButton:InitWidgetRec</tt> example that
|
||||
the private variable <tt>data(count)</tt> was initialized there. Also,
|
||||
the private variable <tt>data(w:button)</tt> was initialized in <tt>tixArrowButton:ConstructWidget</tt> and subsequently used in <tt>tixArrowButton:SetBindings</tt>.
|
||||
<P>In contrast, public variables must be declared inside the class
|
||||
declaration. The following arguments are used to declare the public
|
||||
variables and specify various options for them:
|
||||
<P>
|
||||
<blockquote> <UL><P><LI><P><tt>-flag</tt>: As shown in the class declaration in figure
|
||||
6-2, the <tt>-flag</tt> argument declares all the public
|
||||
variables of the TixArrowButton class, <tt>-direction</tt> and <tt>-state</tt>
|
||||
<P><LI><P><tt>-configspec</tt>: We can use the <tt>-configspec</tt> argument to
|
||||
specify the details of each public variable. For example, the
|
||||
following declaration
|
||||
<P>
|
||||
<blockquote> <P><tt> -configspec {<BR>
|
||||
{-direction direction Direction e}<BR>
|
||||
{-state state State normal}<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>specifies that the <tt>-direction</tt> variable has the resource
|
||||
name <tt>direction</tt> and resource class <tt>Direction</tt>; its default
|
||||
value is <tt>e</tt>. The application programmer can assign value to
|
||||
this variable by using the <tt>-direction</tt> option in the command
|
||||
line or by specifying resources in the Tk option database with its
|
||||
resource name or class. The declaration of <tt>-state</tt> installs
|
||||
similar definitions for that variable.
|
||||
<P><LI><P><tt>-alias</tt>: The <tt>-alias</tt> argument is used to specify
|
||||
alternative names for public variables. In our example, the setting
|
||||
<P>
|
||||
<blockquote> <P><tt> -alias {<BR>
|
||||
{-dir -direction}<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>specifies that <tt>-dir</tt> is the same variable as <tt>-direction</tt>. Therefore, when the application issue the command
|
||||
<P>
|
||||
<blockquote> <P><tt> .up config -dir w
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>it is the same as issuing
|
||||
<P>
|
||||
<blockquote> <tt> .up config -direction w
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
The <tt>-alias</tt> option provides only an alternative name for
|
||||
the application programmer. Inside the widget's implementation code,
|
||||
the variable is still accessed as <tt>data(-direction)</tt>, <em>not</em>
|
||||
<tt>data(-dir)</tt>.
|
||||
<P></UL>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
<UL>
|
||||
<LI> <A NAME=tex2html1279 HREF=subsubsection3_8_5_1.html#SECTION00085100000000000000> Initialization of Public Variables<A NAME=651> </A></A>
|
||||
<LI> <A NAME=tex2html1280 HREF=subsubsectionstar3_8_5_2.html#SECTION00085200000000000000> Type Checker<A NAME=6511> </A></A>
|
||||
<LI> <A NAME=tex2html1281 HREF=subsubsection3_8_5_3.html#SECTION00085300000000000000> Public Variable Configuration Methods<A NAME=652> </A></A>
|
||||
<LI> <A NAME=tex2html1282 HREF=subsubsectionstar3_8_5_4.html#SECTION00085400000000000000> Configuration Methods and Public Variable Initialization<A NAME=6521> </A></A>
|
||||
</UL>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
42
docs/html/TixBook/subsection3_8_6.html
Normal file
42
docs/html/TixBook/subsection3_8_6.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<HEAD>
|
||||
<TITLE> Summary of Widget Instance Initialization<A NAME=66> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1333 HREF=subsection3_8_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1331 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1325 HREF=subsubsectionstar3_8_5_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1335 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1334 HREF=subsection3_8_7.html> Loading the New </A>
|
||||
<B>Up:</B> <A NAME=tex2html1332 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1326 HREF=subsubsectionstar3_8_5_4.html> Configuration Methods and </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00086000000000000000> Summary of Widget Instance Initialization<A NAME=66> </A></A></H2>
|
||||
<P>
|
||||
The creation of a widget instance is a complex process. You must
|
||||
understand how it works in order to write your widget classes. The
|
||||
following is the steps taken by the Tix Intrinsics when a widget
|
||||
instance is created:
|
||||
<P>
|
||||
<blockquote> <UL><P><LI><P>When the user creates an instance, the public variables are
|
||||
intilized as discussed in section 6.5.1. Type checkers
|
||||
are always called if they are specified. Configuration methods are
|
||||
called only if they are specified in the <tt>-forcecall</tt> section.
|
||||
<P><LI><P>The <tt>InitWidgetRec</tt> method is called. It should initialize
|
||||
private variable, possibly according to the values the public
|
||||
variables.
|
||||
<P><LI><P>The <tt>ConstructWidget</tt> method is called. It should create the
|
||||
component widgets. It should also store the names of public
|
||||
subwidgets into the subwidget variables.
|
||||
<P><LI><P>The <tt>SetBinding</tt> method is called. It should create bindings for
|
||||
the component widgets.
|
||||
<P></UL>
|
||||
</blockquote>
|
||||
<P>
|
||||
After the above steps, the creation of the instance is complete and the
|
||||
user can iterate with it using its widget command.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
49
docs/html/TixBook/subsection3_8_7.html
Normal file
49
docs/html/TixBook/subsection3_8_7.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<HEAD>
|
||||
<TITLE> Loading the New Classes<A NAME=67> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif_gr.gif"> <A NAME=tex2html1340 HREF=section3_8.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1336 HREF=subsection3_8_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1342 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B>Up:</B> <A NAME=tex2html1341 HREF=section3_8.html> Tix Object Oriented </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1337 HREF=subsection3_8_6.html> Summary of Widget </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00087000000000000000> Loading the New Classes<A NAME=67> </A></A></H2>
|
||||
<P>
|
||||
Usually, you can use a separate script file to store the
|
||||
implementaion of each new widget class. If you have several of those
|
||||
files, it will be a good idea to group the files into a single
|
||||
directory and create a <tt>tclIndex</tt> file for them so that the new
|
||||
classes can be auto-loaded.
|
||||
<P>
|
||||
Suppose you have put the class files into the directory <tt>/usr/my/tix/classes</tt>. You can create the <tt>tclIndex</tt> file using
|
||||
the <tt>tools/tixindex</tt> program that comes with Tix:
|
||||
<P>
|
||||
<blockquote> <P><tt> cd /usr/my/tix/classes<BR>
|
||||
/usr/my/Tix8.1/tools/tixindex *.tcl
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
The <tt>tclIndex</tt> file must be created by the <tt>tixindex</tt>
|
||||
program. You cannot use the standard <tt>auto_mkindex</tt> command
|
||||
that comes with Tcl.
|
||||
<P>
|
||||
Once you have created the <tt>tclIndex</tt> file, you can use your new
|
||||
widget classes by auto-loading. Here is a small demo program that
|
||||
uses the new TixArrowButton class:
|
||||
<P>
|
||||
<blockquote> <P><tt> #!/usr/local/bin/tixwish<BR>
|
||||
lappend auto_path /usr/my/tix/classes<BR>
|
||||
<BR>
|
||||
# Now I can use my TixArrowButton class!<BR>
|
||||
#<BR>
|
||||
tixArrowButton .arr -direction n<BR>
|
||||
pack .arr
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
27
docs/html/TixBook/subsectionstar3_2_1.html
Normal file
27
docs/html/TixBook/subsectionstar3_2_1.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<HEAD>
|
||||
<TITLE> About This Manual<A NAME=01> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html169 HREF=subsectionstar3_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html167 HREF=sectionstar3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html161 HREF=sectionstar3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html171 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html170 HREF=subsectionstar3_2_2.html> About This Document</A>
|
||||
<B>Up:</B> <A NAME=tex2html168 HREF=sectionstar3_2.html> Preface</A>
|
||||
<B> Previous:</B> <A NAME=tex2html162 HREF=sectionstar3_2.html> Preface</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00021000000000000000> About This Manual<A NAME=01> </A></A></H2>
|
||||
<P>
|
||||
This manual is the programmer's guide to the Tix library. It takes you
|
||||
though a step-by-step tutorial about the different widgets and functions
|
||||
available in the Tix library. It also covers how to write new widgets using
|
||||
the Tix Intrinsics objecr-oriented programming interface. The accompanying
|
||||
<em>Tix Reference Manual</em> is a collection of the Tix manual pages. It
|
||||
describes all the options and other details of the Tix widgets and
|
||||
functions.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
25
docs/html/TixBook/subsectionstar3_2_2.html
Normal file
25
docs/html/TixBook/subsectionstar3_2_2.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<HEAD>
|
||||
<TITLE> About This Document<A NAME=02> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html180 HREF=subsectionstar3_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html178 HREF=sectionstar3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html172 HREF=subsectionstar3_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html182 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html181 HREF=subsectionstar3_2_3.html> Organization of This </A>
|
||||
<B>Up:</B> <A NAME=tex2html179 HREF=sectionstar3_2.html> Preface</A>
|
||||
<B> Previous:</B> <A NAME=tex2html173 HREF=subsectionstar3_2_1.html> About This Manual</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00022000000000000000> About This Document<A NAME=02> </A></A></H2>
|
||||
<P>
|
||||
This HTML document is converted from LaTeX source files to HTML by a
|
||||
modified version of latex2html.
|
||||
<P>
|
||||
This document is also available both pdf and HTML format from
|
||||
<A HREF="http://tix.sourceforge.net">http://tix.sourceforge.net</A>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
34
docs/html/TixBook/subsectionstar3_2_3.html
Normal file
34
docs/html/TixBook/subsectionstar3_2_3.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<HEAD>
|
||||
<TITLE> Organization of This Manual<A NAME=03> </A><A NAME=04> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html189 HREF=section3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html187 HREF=sectionstar3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html183 HREF=subsectionstar3_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html191 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html190 HREF=section3_3.html> Introduction</A>
|
||||
<B>Up:</B> <A NAME=tex2html188 HREF=sectionstar3_2.html> Preface</A>
|
||||
<B> Previous:</B> <A NAME=tex2html184 HREF=subsectionstar3_2_2.html> About This Document</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H2><A NAME=SECTION00023000000000000000> Organization of This Manual<A NAME=03> </A><A NAME=04> </A></A></H2>
|
||||
<P>
|
||||
Chapter 1, <em>Introduction</em> gets you started with the
|
||||
Tix widgets by describing their basic options and
|
||||
operations. Chapter 2, <em>Container Widgets</em>,
|
||||
describes the Tix widgets that can be used to contain other widgets
|
||||
and maintain their geometry. Chapter 3, <em>TList
|
||||
Widget and Display Items</em>, describes the tabular listbox widget and
|
||||
the Tix display items, which are used by many Tix widgets. Chapter
|
||||
4, <em>Hierarchical Listbox</em>, describes how to create
|
||||
a hierarchical list structure using the TixHList widget. Chapter
|
||||
5, <em>Selection Files and Directories</em>, describes
|
||||
how to use the file and directory selection widgets in the Tix
|
||||
library. Finally, Chapter 6, <em>Tix Object Oriented
|
||||
Programming</em>, describes how to use the Tix object oriented
|
||||
programming library to create new classes of Tix widgets.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
59
docs/html/TixBook/subsubsection3_3_1_1.html
Normal file
59
docs/html/TixBook/subsubsection3_3_1_1.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<HEAD>
|
||||
<TITLE> Tix for Application Programmers<A NAME=111> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html253 HREF=subsubsection3_3_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html251 HREF=subsection3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html245 HREF=subsection3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html255 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html254 HREF=subsubsection3_3_1_2.html> Tix for Widget </A>
|
||||
<B>Up:</B> <A NAME=tex2html252 HREF=subsection3_3_1.html> What is Tix</A>
|
||||
<B> Previous:</B> <A NAME=tex2html246 HREF=subsection3_3_1.html> What is Tix</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00031100000000000000> Tix for Application Programmers<A NAME=111> </A></A></H3>
|
||||
<P>
|
||||
The acronym Tix stands for Tk Interface Extension. Tix is different
|
||||
things for different people.
|
||||
<P>
|
||||
If you are a GUI application programmer, that is, if you earn a
|
||||
living by building graphical applications, you will appreciate Tix
|
||||
as a library of <em>mega-widgets</em>: widgets made out of other
|
||||
widgets. To use a crude analogy, if the widgets in the standard TK
|
||||
library are bricks and mortars for a builder, the mega-widgets in
|
||||
the Tix library are walls, windows or even pre-build kitchens. Of
|
||||
course, these ``bigger components'' are themselves made of bricks
|
||||
and mortars, but it will take much less effort to put them together
|
||||
than planting bricks on top of each other.
|
||||
<P>
|
||||
The Tix widgets not only help you speed up the development of your
|
||||
applications, they also help you in the design process. Since the
|
||||
standard Tk widgets are too primitive, they force you to think of
|
||||
your house as, by using the same analogy, millions of bricks. With
|
||||
the help of the Tix mega-widgets, you can design your application is
|
||||
a more structural and coherent manner.
|
||||
<P>
|
||||
Moreover, the Tix library provides a rich set of widgets. Figure
|
||||
1-1 shows all Tix widgets - there are more than 40
|
||||
of them! Although the standard Tk library has many useful widgets,
|
||||
they are far from complete. The Tix library provides most of the
|
||||
commonly needed widgets that are missing from standard Tk:
|
||||
FileSelectBox, ComboBox, Control (a.k.a. SpinBox) and an assortment
|
||||
of scroll-able widgets. Tix also includes many more widgets that are
|
||||
generally useful in a wide range of applications: NoteBook,
|
||||
FileEntry, PanedWindow, MDIWindow, etc.
|
||||
<P>
|
||||
With all these new widgets, you can introduce new interaction
|
||||
techniques into applications, creating more useful and more
|
||||
intuitive user interfaces. You can design your application by
|
||||
choosing the most appropriate widgets to match the special needs of
|
||||
your application and users.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/hierarchy.png">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
39
docs/html/TixBook/subsubsection3_3_1_2.html
Normal file
39
docs/html/TixBook/subsubsection3_3_1_2.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<HEAD>
|
||||
<TITLE> Tix for Widget Developers<A NAME=112> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html262 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html260 HREF=subsection3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html256 HREF=subsubsection3_3_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html264 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html263 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<B>Up:</B> <A NAME=tex2html261 HREF=subsection3_3_1.html> What is Tix</A>
|
||||
<B> Previous:</B> <A NAME=tex2html257 HREF=subsubsection3_3_1_1.html> Tix for Application </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00031200000000000000> Tix for Widget Developers<A NAME=112> </A></A></H3>
|
||||
<P>
|
||||
On the other hand, if you are a widget developer, Tix provides an
|
||||
object oriented programming environment, the Tix Intrinsics, that is
|
||||
carefully designed for the development of mega-widgets. If you have
|
||||
developed widgets in C, you will know how slow and painful such a
|
||||
process would be. In recognition of the difficulties in widget
|
||||
development, the Tix Intrinsics includes many tools that
|
||||
dramatically cuts down the efforts required to develop new widgets.
|
||||
With the Tix Intrinsics, the rapid prototyping/development of
|
||||
widgets is finally feasible: you can write a new widgets in the
|
||||
matter of hours or even minutes.
|
||||
<P>
|
||||
With the Tix Intrinsics, you widget code can readily become
|
||||
reusable. Tix also provides a set of rules and mechanisms that
|
||||
allow you to develop widgets that are inter-operable with other
|
||||
widgets.
|
||||
<P>
|
||||
In Part I of this manual, we will talk about using the Tix widgets.
|
||||
The discussion of writing new Tix widgets will be carried out in
|
||||
Part II.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
71
docs/html/TixBook/subsubsection3_3_2_1.html
Normal file
71
docs/html/TixBook/subsubsection3_3_2_1.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating a TixControl Widget<A NAME=121> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html288 HREF=subsubsection3_3_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html286 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html280 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html290 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html289 HREF=subsubsection3_3_2_2.html> Accessing The Value </A>
|
||||
<B>Up:</B> <A NAME=tex2html287 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<B> Previous:</B> <A NAME=tex2html281 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00032100000000000000> Creating a TixControl Widget<A NAME=121> </A></A></H3>
|
||||
<P>
|
||||
The following code demonstrates how to create a TixControl widget and
|
||||
specify its options:
|
||||
<P>
|
||||
<tt> tixControl .lawyers -label Lawyers: -max 10 -min 0<BR>
|
||||
.lawyers config -integer true -step 2
|
||||
</tt>
|
||||
<P>
|
||||
This example creates a TixControl widget that let us to select the
|
||||
numbers of lawyers we wish to be allowed in this country. (Figure
|
||||
1-2)
|
||||
<P>
|
||||
Let us examine the options: the <tt>-label</tt> option specifies a
|
||||
caption for this widget. The <tt>-max</tt> option specifies the maximum
|
||||
number of lawyers we can choose. The <tt>-min</tt> option specifies the
|
||||
minimum number of lawyers we can choose: although we would love to
|
||||
enter a negative number, reality dictate that the lower limit must
|
||||
be zero. The <tt>-integer</tt> option indicates that the number of
|
||||
lawyers must be an integer; that is, we respect the lawyers' rights
|
||||
not to be chopped up into decimal points. Finally, since lawyers
|
||||
seem to go in pairs, we set the <tt>-step</tt> option to <tt>2</tt>, which
|
||||
indicates that when we press the up/down arrow buttons, we want the
|
||||
number of lawyers to go up and down by two each time.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/lawyer.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
As shown in the example, you can create and manipulate a Tix widget
|
||||
in the same manner as the standard Tk widgets. The options of the
|
||||
widget can be specified during the creation of the widget.
|
||||
Alternatively, they can be changed by the <tt>configure</tt> widget
|
||||
command. In addition, options can also be specified in the option
|
||||
database or as X resources. Here is an example that produces the
|
||||
same result as the previous code fragment:
|
||||
<P>
|
||||
<tt> option add *lawyers.max 10<BR>
|
||||
option add *lawyers.min 0<BR>
|
||||
tixControl .lawyers -label Lawyers: -integer true<BR>
|
||||
.lawyers config -step 2
|
||||
</tt>
|
||||
<P>
|
||||
In figure 1-3, you can see the composition of
|
||||
TixControl: it is made out of a label widget, an entry widget and
|
||||
two button widgets. Widgets that are composed of other widgets, like
|
||||
TixControl, are called <em>mega-widgets</em>. Most widgets in the Tix
|
||||
library are mega-widgets (xx: and as you know this book is about
|
||||
them!).
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/law_comp.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
51
docs/html/TixBook/subsubsection3_3_2_2.html
Normal file
51
docs/html/TixBook/subsubsection3_3_2_2.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<HEAD>
|
||||
<TITLE> Accessing The Value of a TixControl Widget<A NAME=122> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html299 HREF=subsubsectionstar3_3_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html297 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html291 HREF=subsubsection3_3_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html301 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html300 HREF=subsubsectionstar3_3_2_3.html> Disabling Callbacks Temporarily</A>
|
||||
<B>Up:</B> <A NAME=tex2html298 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<B> Previous:</B> <A NAME=tex2html292 HREF=subsubsection3_3_2_1.html> Creating a TixControl </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00032200000000000000> Accessing The Value of a TixControl Widget<A NAME=122> </A></A></H3>
|
||||
<P>
|
||||
The TixControl widget allows the user to input a value. There are
|
||||
several ways to read this value in your program. First of all,
|
||||
TixControl stores the current value in the <tt>-value</tt> option. You
|
||||
can use query the <tt>-value</tt> option by calling the command
|
||||
<P>
|
||||
<tt> .c cget -value
|
||||
</tt>
|
||||
this command will return the current value of the tixContro widget
|
||||
<tt>.c</tt>. The following command sets the value of the widget to a
|
||||
new number (100):
|
||||
<P>
|
||||
<tt> .c config -value 100
|
||||
</tt>
|
||||
<P>
|
||||
The second way to access the value of TixControl is to use the <tt>-variable</tt> option. This options instructs the TixControl widget to
|
||||
store the its value into a global variable so that you can read it
|
||||
at any time. Also, by assigning a new value to this global variable,
|
||||
you can change the value of the TixControl widget. Here is an
|
||||
example:
|
||||
<P>
|
||||
<tt> .c config -variable myvar<BR>
|
||||
set myvar 100
|
||||
</tt>
|
||||
<P>
|
||||
In some situations, you may want to be informed immediately when the
|
||||
value of the TixControl widget changes. To accomplish this, you can use
|
||||
the <tt>-command</tt> option. The following line causes the TCL procedure
|
||||
<tt>valueChanged</tt> to be called whenever the value of <tt>.c</tt> changes:
|
||||
<P>
|
||||
<tt> tixControl .c -command valueChanged
|
||||
</tt>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
38
docs/html/TixBook/subsubsection3_3_2_4.html
Normal file
38
docs/html/TixBook/subsubsection3_3_2_4.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<HEAD>
|
||||
<TITLE> Validating User Inputs<A NAME=123> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html319 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html317 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html313 HREF=subsubsectionstar3_3_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html321 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html320 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B>Up:</B> <A NAME=tex2html318 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<B> Previous:</B> <A NAME=tex2html314 HREF=subsubsectionstar3_3_2_3.html> Disabling Callbacks Temporarily</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00032400000000000000> Validating User Inputs<A NAME=123> </A></A></H3>
|
||||
<P>
|
||||
Sometimes it may be necessary to check the user input against certain
|
||||
criteria. For example, you may want to allow only even numbers in a
|
||||
TixControl widget. To do this, you can use the <tt>-validatecmd</tt> option,
|
||||
which specifies a Tcl command to call whenever the user enters a new
|
||||
value. Here is an example:
|
||||
<P>
|
||||
<tt> tixControl .c -value 0 -step 2 -validatecmd evenOnly<BR>
|
||||
<BR>
|
||||
proc evenOnly {value} {<BR>
|
||||
return [expr $value - ($value %2)]<BR>
|
||||
}</tt>
|
||||
<P>
|
||||
The value parameter to <tt>evenOnly</tt> is the new value entered by
|
||||
the user. The <tt>evenOnly</tt> procedure makes sure that the new
|
||||
value is even by returning a modified, even number. The Tcl command
|
||||
specified by the <tt>-validatecmd</tt> must return a value which it
|
||||
deems valid and this value will be stored in the <tt>-value</tt> option
|
||||
of the TixControl widget.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
27
docs/html/TixBook/subsubsection3_3_3_1.html
Normal file
27
docs/html/TixBook/subsubsection3_3_3_1.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<HEAD>
|
||||
<TITLE> Subwidgets<A NAME=131> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html348 HREF=subsubsection3_3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html346 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html340 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html350 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html349 HREF=subsubsection3_3_3_2.html> Subwidget Names</A>
|
||||
<B>Up:</B> <A NAME=tex2html347 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html341 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033100000000000000> Subwidgets<A NAME=131> </A></A></H3>
|
||||
<P>
|
||||
As we have seen in section 1.2.1, the TixControl
|
||||
widget is composed of several widgets: one label widget, one entry
|
||||
widget and two button widgets. These ``widgets inside mega-widgets''
|
||||
are called <em>subwidgets</em> in the Tix terminology. We will often
|
||||
have the need to access these subwidgets. For example, sometimes we
|
||||
need to change the configuration options of the subwidgets. In other
|
||||
cases, we may need to interact with the subwidgets directly.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
30
docs/html/TixBook/subsubsection3_3_3_2.html
Normal file
30
docs/html/TixBook/subsubsection3_3_3_2.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<HEAD>
|
||||
<TITLE> Subwidget Names<A NAME=132> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html359 HREF=subsubsection3_3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html357 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html351 HREF=subsubsection3_3_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html361 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html360 HREF=subsubsection3_3_3_3.html> The subwidget Method</A>
|
||||
<B>Up:</B> <A NAME=tex2html358 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html352 HREF=subsubsection3_3_3_1.html> Subwidgets</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033200000000000000> Subwidget Names<A NAME=132> </A></A></H3>
|
||||
<P>
|
||||
Each subwidget inside a mega is identified by a <em>subwidget
|
||||
name</em>. Naturally, the label and entry subwidgets inside a TixSelect
|
||||
widget are called <tt>label</tt> and <tt>entry</tt>, respectively. The two
|
||||
button widgets are called <tt>incr</tt> and <tt>decr</tt> because they are
|
||||
used to <tt>incr</tt>ement and <tt>decr</tt>ement the value inside the
|
||||
TixControl widget (see figure 1-4).
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/intro/ctl_subw.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
63
docs/html/TixBook/subsubsection3_3_3_3.html
Normal file
63
docs/html/TixBook/subsubsection3_3_3_3.html
Normal file
@@ -0,0 +1,63 @@
|
||||
<HEAD>
|
||||
<TITLE> The <tt>subwidget</tt> Method<A NAME=133> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html370 HREF=subsubsection3_3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html368 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html362 HREF=subsubsection3_3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html372 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html371 HREF=subsubsection3_3_3_4.html> Chaining the subwidget </A>
|
||||
<B>Up:</B> <A NAME=tex2html369 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html363 HREF=subsubsection3_3_3_2.html> Subwidget Names</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033300000000000000> The <tt>subwidget</tt> Method<A NAME=133> </A></A></H3>
|
||||
<P>
|
||||
All Tix mega-widgets support the <tt>subwidget</tt> method. This method
|
||||
takes at least one argument, the name of a subwidget. When you pass
|
||||
only one argument to this method, it returns the pathname of the
|
||||
subwidget which is identified by that name. For example, if .c is
|
||||
the pathname of a TixControl widget, the command:
|
||||
<P>
|
||||
<blockquote> <tt> .c subwidget entry
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
returns the pathname of the <tt>entry</tt> subwidget, which is <tt>.c.frame.entry</tt> in this case.
|
||||
<P>
|
||||
If you call the <tt>subwidget</tt> method with additional arguments, the
|
||||
widget command of the specified subwidget will be called with these
|
||||
arguments. For example, if <tt>.c</tt> is, again, the pathname of a
|
||||
TixControl widget, the command:
|
||||
<P>
|
||||
<blockquote> <tt> .c subwidget entry configure -bg gray
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
will cause the widget command of the <tt>entry</tt> subwidget of <tt>.c</tt> to be called with the arguments <tt>configure -bg gray</tt>. So
|
||||
actually this command will be translated into the following call:
|
||||
<P>
|
||||
<blockquote> <tt> .c.frame.entry configure -bg gray
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
which calls the <tt>configure</tt> method of the <tt>entry</tt> subwidget
|
||||
with the arguments <tt>-bg gray</tt> and changes its background color
|
||||
to <tt>gray</tt>.
|
||||
<P>
|
||||
We can call the <tt>subwidget</tt> method with other types of arguments
|
||||
to access different methods of the specified subwidget. For example,
|
||||
the following call:
|
||||
<P>
|
||||
<blockquote> <tt> .c subwidget entry icursor end
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
calls the <tt>icursor</tt> method of the <tt>entry</tt> subwidget with the
|
||||
argument <tt>end</tt> and sets the insert cursor of the <tt>entry</tt>
|
||||
subwidget to the end of its input string.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
42
docs/html/TixBook/subsubsection3_3_3_4.html
Normal file
42
docs/html/TixBook/subsubsection3_3_3_4.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<HEAD>
|
||||
<TITLE> Chaining the <tt>subwidget</tt> Method<A NAME=134> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html381 HREF=subsubsection3_3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html379 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html373 HREF=subsubsection3_3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html383 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html382 HREF=subsubsection3_3_3_5.html> Configuring Subwidget Options </A>
|
||||
<B>Up:</B> <A NAME=tex2html380 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html374 HREF=subsubsection3_3_3_3.html> The subwidget Method</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033400000000000000> Chaining the <tt>subwidget</tt> Method<A NAME=134> </A></A></H3>
|
||||
<P>
|
||||
Some Tix mega-widgets may have subwidgets that in turn contain
|
||||
subwidgets. For example, the TixExFileSelectDialog (section
|
||||
5.1.3) widget contains a TixExFileSelectBox subwidget
|
||||
called <tt>fsbox</tt>, which in turn contains a TixComboBox (section
|
||||
1.4) subwidget called <tt>dir</tt>. If we want to access
|
||||
the <tt>dir</tt> subwidget, we can just ``chain'' the <tt>subwidget</tt>
|
||||
method. For example, if we have a TixExFileSelectDialog called <tt>.file</tt>, the following command will return the pathname of the <tt>dir</tt> subwidget of the <tt>fsbox</tt> subwidget of <tt>.file</tt>:
|
||||
<P>
|
||||
<blockquote> <tt> .file subwidget fsbox subwidget dir
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
Moreover, the following command configures the <tt>dir</tt> subwidget to
|
||||
have a border of the groove type with a border width of 2 pixels:
|
||||
<P>
|
||||
<blockquote> <tt> .file subwidget fsbox subwidget dir configure -bd 2 -relief groove
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
The chaining of the subwidget command can be applied for arbitrarily
|
||||
many levels, depending whether your widget has a subwidget that has
|
||||
a subwidget that has a subwidget that has a subwidget ... and so on.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
84
docs/html/TixBook/subsubsection3_3_3_5.html
Normal file
84
docs/html/TixBook/subsubsection3_3_3_5.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<HEAD>
|
||||
<TITLE> Configuring Subwidget Options Using the <tt>-options</tt> Switch<A NAME=135> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html392 HREF=subsubsection3_3_3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html390 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html384 HREF=subsubsection3_3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html394 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html393 HREF=subsubsection3_3_3_6.html> Configuring Subwidget Options </A>
|
||||
<B>Up:</B> <A NAME=tex2html391 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html385 HREF=subsubsection3_3_3_4.html> Chaining the subwidget </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033500000000000000> Configuring Subwidget Options Using the <tt>-options</tt> Switch<A NAME=135> </A></A></H3>
|
||||
<P>
|
||||
As we have seen above, we can use commands like ``<tt>subwidget</tt> <em>name</em> <tt>configure ...</tt>'' to set the configuration options of
|
||||
subwidgets. However, this can get quite tedious if we want to configure
|
||||
many options of many subwidgets.
|
||||
<P>
|
||||
There is a more convenient and terse way to configure the subwidget options
|
||||
without using the <tt>subwidget</tt> method: the <tt>-options</tt> switch. All
|
||||
Tix mega-widgets support the <tt>-option</tt> switch, which can be used
|
||||
during the creation of the mega-widget.
|
||||
<P>
|
||||
<blockquote> <tt> tixControl .income -label "Income: " -variable income -options {<BR>
|
||||
label.width 8<BR>
|
||||
label.anchor e<BR>
|
||||
entry.width 10<BR>
|
||||
entry.borderWidth 3<BR>
|
||||
}<BR>
|
||||
tixControl .age -label "Age: " -variable age -options {<BR>
|
||||
label.width 8<BR>
|
||||
label.anchor e<BR>
|
||||
entry.width 10<BR>
|
||||
entry.borderWidth 3<BR>
|
||||
}<BR>
|
||||
pack .income .age -side top
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P><CENTER>(Figure 1-5) Using the <tt>-options</tt> switch<A NAME=15> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/intro/ctl_noopt.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/intro/ctl_wopt.gif"><BR CLEAR=LEFT><CENTER>(Figure 1-6) Using the <tt>-options</tt> Switch to Align the Labels<A NAME=16> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
The use of the <tt>-options</tt> switch is illustrated in program
|
||||
1-5, which creates two TixControl widgets for
|
||||
the user to enter his income and age. Because of the different sizes
|
||||
of the labels of these two widgets, if we create them haphazardly,
|
||||
the output may look like fig 1-6.
|
||||
<P>
|
||||
To avoid this problem, we set the width of the <tt>label</tt>
|
||||
subwidgets of the <tt>.income</tt> and <tt>.age</tt> widgets to be the
|
||||
same (8 characters wide) and set their <tt>-anchor</tt> option to <tt>e</tt> (flushed to right), so that the labels appear to be
|
||||
well-aligned. Program 1-5 also does other
|
||||
things such as setting the <tt>entry</tt> subwidgets to have a width of
|
||||
10 characters and a border-width of 3 pixels so that they appear
|
||||
wider and ``deeper''. A better result is shown in figure
|
||||
1-6.
|
||||
<P>
|
||||
As we can see from program 1-5, the value for
|
||||
the <tt>-options</tt> switch is a list of one or more pairs of
|
||||
<P>
|
||||
<blockquote> <em>subwidget-option-spec</em> <em>value</em> ..
|
||||
</blockquote>
|
||||
<P>
|
||||
<em>subwidget-option-spec</em> is in the form <em>subwidget-name</em><tt>.</tt><em>option-name</em>. For example, <tt>label.anchor</tt> identifies the
|
||||
<tt>anchor</tt> option of the <tt>label</tt> subwidget, <tt>entry.width</tt>
|
||||
identifies the <tt>width</tt> option of the entry subwidget, and so on.
|
||||
<P>
|
||||
Notice we must use the <em>name</em> of the option, not the <em>command-line switch</em> of the option. For example, the option that
|
||||
specifies the border-width of the <tt>entry</tt> subwidget has the
|
||||
command-line switch <tt>-borderwidth</tt> but its name is <tt>borderWidth</tt> (notice the capitalization on the name but not on the
|
||||
command-line switch). Therefore, we have used the capitalized version
|
||||
of ``<tt>entry.borderWidth 3</tt>'' in program
|
||||
1-5 and not ``<tt>entry.borderwidth 3</tt>''. To
|
||||
find out the names of the options of the respective subwidgets,
|
||||
please refer to their manual pages.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
71
docs/html/TixBook/subsubsection3_3_3_6.html
Normal file
71
docs/html/TixBook/subsubsection3_3_3_6.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<HEAD>
|
||||
<TITLE> Configuring Subwidget Options Using the Tk Option Database<A NAME=136> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html403 HREF=subsubsection3_3_3_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html401 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html395 HREF=subsubsection3_3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html405 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html404 HREF=subsubsection3_3_3_7.html> Caution: Restricted Access</A>
|
||||
<B>Up:</B> <A NAME=tex2html402 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html396 HREF=subsubsection3_3_3_5.html> Configuring Subwidget Options </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033600000000000000> Configuring Subwidget Options Using the Tk Option Database<A NAME=136> </A></A></H3>
|
||||
<P>
|
||||
The <tt>-options</tt> switch is good if you want to specify subwidget
|
||||
options for one or a few mega-widgets. If you want to specify the
|
||||
subwidget for many mega-widgets, it is easier to use the Tk Option
|
||||
Database.
|
||||
<P>
|
||||
Options in the Tk Option Database can be specified using the <tt>option</tt> command and the pathname of the widget. For all the Tix
|
||||
mega-widgets, it is guaranteed that the pathname of their subwidgets
|
||||
ends with the <em>name</em> of the subwidgets. For example, if we have
|
||||
a mega widget called <tt>.a.b.megaw</tt> and it has a subwidget whose
|
||||
name is <tt>subw</tt>, then we can be sure that the pathname of the
|
||||
subwidget will be something like
|
||||
<P>
|
||||
<blockquote> <tt> .a.b.megaw.foo.bar.subw
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
Therefore, if we want to specify options for it in the Option
|
||||
Database, we can issue commands like:
|
||||
<P>
|
||||
<blockquote> <tt> option add *a.b.megaw*subw.option1 value1<BR>
|
||||
option add *a.b.megaw*subw.option2 value2
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
Notice that it will be wrong to issue the commands as:
|
||||
<P>
|
||||
<blockquote> <tt> option add *a.b.megaw.subw.option1 value1<BR>
|
||||
option add *a.b.megaw.subw.option2 value2
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
because in general we will not know whether the subwidget is an
|
||||
immediate child window of <tt>.a.b.megaw</tt> (<em>such a decision
|
||||
is left to the mega-widget implementor and may vary in different
|
||||
versions of the same mega-widget</em>).
|
||||
<P>
|
||||
Program 1-7 demonstrates how the Tk Option Database can be
|
||||
used to achieve the same effect as program 1-5.
|
||||
<P>
|
||||
<blockquote> <tt> option add *TixControl*label.width 8<BR>
|
||||
option add *TixControl*label.anchor e<BR>
|
||||
option add *TixControl*entry.width 10<BR>
|
||||
option add *TixControl*entry.borderWidth 3<BR>
|
||||
<BR>
|
||||
tixControl .income -label "Income: " -variable income<BR>
|
||||
tixControl .age -label "Age: " -variable age<BR>
|
||||
<BR>
|
||||
pack .income .age -side top
|
||||
</tt>
|
||||
</blockquote>
|
||||
(Figure 1-7) Using the Tk Option Database in Place of the <tt>-options</tt> switch<A NAME=17> </A>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_3_3_7.html
Normal file
31
docs/html/TixBook/subsubsection3_3_3_7.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Caution: Restricted Access<A NAME=137> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html412 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html410 HREF=subsection3_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html406 HREF=subsubsection3_3_3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html414 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html413 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<B>Up:</B> <A NAME=tex2html411 HREF=subsection3_3_3.html> Accessing The Components </A>
|
||||
<B> Previous:</B> <A NAME=tex2html407 HREF=subsubsection3_3_3_6.html> Configuring Subwidget Options </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00033700000000000000> Caution: Restricted Access<A NAME=137> </A></A></H3>
|
||||
<P>
|
||||
In the current implementation of Tix, there is no limits on how you
|
||||
can access the options of the subwidgets. However, many options of
|
||||
the subwidgets may be already used by the mega-widget in special
|
||||
ways. For example, the <tt>-textvariable</tt> option of the <tt>entry</tt>
|
||||
subwidget of TixControl may be used to store some private
|
||||
information for the mega widget. Therefore, you should access the
|
||||
options of the subwidgets with great care. In general you should
|
||||
only access those options that affect the appearance of the
|
||||
subwidgets (such as <tt>-font</tt> or <tt>-foreground</tt>) and leave
|
||||
everything else intact. (<em></em>) {In future versions of Tix, there
|
||||
will be explicit restrictions on which subwidget options you can
|
||||
access. Errors will be generated if you try to access restricted
|
||||
subwidget options}<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
43
docs/html/TixBook/subsubsection3_3_4_1.html
Normal file
43
docs/html/TixBook/subsubsection3_3_4_1.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating a TixComboBox Widget<A NAME=141> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html438 HREF=subsubsection3_3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html436 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html430 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html440 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html439 HREF=subsubsection3_3_4_2.html> Controlling the Style </A>
|
||||
<B>Up:</B> <A NAME=tex2html437 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<B> Previous:</B> <A NAME=tex2html431 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00034100000000000000> Creating a TixComboBox Widget<A NAME=141> </A></A></H3>
|
||||
<P>
|
||||
<blockquote> <tt> tixComboBox .c -label "Animal:" -editable true<BR>
|
||||
.c insert end cat<BR>
|
||||
.c insert end dog<BR>
|
||||
.c insert end pig
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P><CENTER>(Figure 1-9) Creating a ComboBox<A NAME=19> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
In program 1-9, we set up a ComboBox <tt>.c</tt>
|
||||
for the user to select an animal to play with. If the user is just a
|
||||
dull person like you and me, he would just press the arrow button
|
||||
and select a pre-designated animal such as ``dog''. However, if he
|
||||
wants to try something new, he could type ``micky'' or ``sloth''
|
||||
into the entry widget and he will get to play with his favorite
|
||||
animal.
|
||||
<P>
|
||||
Of course, sometimes we don't want too many sloths around us and we
|
||||
want to limit the range of the user's selections. In this case we
|
||||
can do one of two things. First, we can set the <tt>-editable</tt>
|
||||
option to <tt>false</tt> so that the user cannot type in the entry
|
||||
widget at all. Alternatively, we can use the <tt>-validatecmd</tt>
|
||||
option (see section 1.4.3) to check input the input.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_3_4_2.html
Normal file
31
docs/html/TixBook/subsubsection3_3_4_2.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Controlling the Style of the TixComboBox<A NAME=142> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html449 HREF=subsubsection3_3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html447 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html441 HREF=subsubsection3_3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html451 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html450 HREF=subsubsection3_3_4_3.html> Static Options</A>
|
||||
<B>Up:</B> <A NAME=tex2html448 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<B> Previous:</B> <A NAME=tex2html442 HREF=subsubsection3_3_4_1.html> Creating a TixComboBox </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00034200000000000000> Controlling the Style of the TixComboBox<A NAME=142> </A></A></H3>
|
||||
<P>
|
||||
The TixComboBox widget can appear in many different styles. If we
|
||||
set the <tt>-dropdown</tt> option to <tt>true</tt> (which is the default),
|
||||
the listbox will only appear when the user presses the arrow button.
|
||||
When <tt>-dropdown</tt> is set to <tt>false</tt>, the listbox is always
|
||||
shown and the arrow button will disappear because it is not needed
|
||||
anymore.
|
||||
<P>
|
||||
There is also an option called <tt>-fancy</tt>. It is set to <tt>false</tt> by default. When set to <tt>true</tt>, a tick button and a cross
|
||||
button will appear next to the entry widget. The tick button allows
|
||||
you to select again the value that's already in the ComboBox. If you
|
||||
press the cross button, the entry widget will be cleared.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
50
docs/html/TixBook/subsubsection3_3_4_3.html
Normal file
50
docs/html/TixBook/subsubsection3_3_4_3.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<HEAD>
|
||||
<TITLE> Static Options<A NAME=143> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html460 HREF=subsubsection3_3_4_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html458 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html452 HREF=subsubsection3_3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html462 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html461 HREF=subsubsection3_3_4_4.html> Monitoring the User's </A>
|
||||
<B>Up:</B> <A NAME=tex2html459 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<B> Previous:</B> <A NAME=tex2html453 HREF=subsubsection3_3_4_2.html> Controlling the Style </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00034300000000000000> Static Options<A NAME=143> </A></A></H3>
|
||||
<P>
|
||||
The <tt>-dropdown</tt> and <tt>-fancy</tt> options are so-called ``static
|
||||
options''. They can only be set during the creation of the
|
||||
ComboBox. Hence this code is valid:
|
||||
<P>
|
||||
<tt> tixComboBox .c -dropdown true
|
||||
</tt>
|
||||
<P>
|
||||
But the following code will generate an error because it attempts to
|
||||
set the <tt>-dropdown</tt> option <em>after</em> the ComboBox has already
|
||||
been created.
|
||||
<P>
|
||||
<tt> TixComboBox .c<BR>
|
||||
.c config -dropdown true
|
||||
</tt>
|
||||
<P>
|
||||
The restrictions of the static options, although annoying,
|
||||
nevertheless make sense because we don't want our interface to
|
||||
suddenly change its style. If sometimes a button is there and
|
||||
sometimes it disappear all by itself, that will certainly create a
|
||||
lot of confusion and makes the user wonder why he should buy our
|
||||
software. Also, as you will see in chapter 6, having some
|
||||
static options will make the life of widget writers a lot easier.
|
||||
<P>
|
||||
Accessing the value of the ComboBox is very similar to accessing the
|
||||
value of the TixControl widget. The ComboBox has these four options,
|
||||
which we discussed in section 1.2.2: <tt>-value</tt>,
|
||||
<tt>-variable</tt>, <tt>-command</tt> and <tt>-validatecmd</tt>. You can use
|
||||
these four options to access the user input and respond to user
|
||||
actions in exactly the same way as discussed in section
|
||||
1.2.2.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
73
docs/html/TixBook/subsubsection3_3_4_4.html
Normal file
73
docs/html/TixBook/subsubsection3_3_4_4.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<HEAD>
|
||||
<TITLE> Monitoring the User's Browsing Actions<A NAME=144> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html469 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html467 HREF=subsection3_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html463 HREF=subsubsection3_3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html471 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html470 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B>Up:</B> <A NAME=tex2html468 HREF=subsection3_3_4.html> Another Tix Widget: </A>
|
||||
<B> Previous:</B> <A NAME=tex2html464 HREF=subsubsection3_3_4_3.html> Static Options</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00034400000000000000> Monitoring the User's Browsing Actions<A NAME=144> </A></A></H3>
|
||||
<P>
|
||||
When the user drags the mouse pointer over the listbox, the listbox
|
||||
item under the pointer will be highlighted and a ``browse event''
|
||||
will be generated. If you want to keep track of what items the user
|
||||
has browses through, you can use the <tt>-browsecmd</tt> option. Here
|
||||
is an example:
|
||||
<P>
|
||||
<tt> tixComboBox .c -browsecmd mybrowse<BR>
|
||||
....<BR>
|
||||
<BR>
|
||||
proc mybrowse {item} {<BR>
|
||||
puts "user has browsed $item"<BR>
|
||||
}</tt>
|
||||
<P>
|
||||
When the Tcl command specified by the <tt>-browsecmd</tt> option is
|
||||
called, it will be called with one parameter: the current item that
|
||||
the user has highlighted.
|
||||
<P>
|
||||
The <tt>-browsecmd</tt> is useful because it gives the user the
|
||||
possibility of temporarily seeing the results of several choices
|
||||
before committing to a final choice.
|
||||
<P>
|
||||
For example, we can list a set of image files in a ComboBox. When
|
||||
the user single-clicks on an item on the ComboBox, we want to show a
|
||||
simplified view of that image. After the user has browsed through
|
||||
several images, he can finally decide on which image he wants by
|
||||
double-clicking on that item in the listbox.
|
||||
<P>
|
||||
The following is some pseudo Tcl code that does this. Please notice
|
||||
that the <tt>-browsecmd</tt> procedure is called every time the user
|
||||
single-clicks on an item or drags the mouse pointer in the listbox.
|
||||
The <tt>-command</tt> procedure is only called when the user
|
||||
double-clicks on an item.
|
||||
<P>
|
||||
<tt> tixComboBox .c -dropdown false -browsecmd show_simple -command load_fullsize <BR>
|
||||
.c insert end "/pkg/images/flowers.gif"<BR>
|
||||
.c insert end "/pkg/images/jimmy.gif"<BR>
|
||||
.c insert end "/pkg/images/ncsa.gif"<BR>
|
||||
<BR>
|
||||
proc show_simple {filename} {<BR>
|
||||
# Load in a simplified version of $filename<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
proc load_fullsize {filename} {<BR>
|
||||
# Load in the full size image in $filename<BR>
|
||||
}</tt>
|
||||
<P>
|
||||
As we shall see, all Tix widgets that let us do some sort of
|
||||
selections have the <tt>-browsecmd</tt> option. The <tt>-browsecmd</tt>
|
||||
option allows us to respond to user events in a simple,
|
||||
straight-forward manner. Of course, you can do the same thing with
|
||||
the Tk <tt>bind</tt> command, but you don't want to do that unless you
|
||||
are very fond of things like <tt>$<$Control-Shift-ButtonRelease-1$>$</tt>
|
||||
and <tt>"%x%X$w%W%w"</tt>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
32
docs/html/TixBook/subsubsection3_3_5_1.html
Normal file
32
docs/html/TixBook/subsubsection3_3_5_1.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating A TixSelect Widget<A NAME=151> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html496 HREF=subsubsectionstar3_3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html494 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html488 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html498 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html497 HREF=subsubsectionstar3_3_5_2.html> Label and Orientation</A>
|
||||
<B>Up:</B> <A NAME=tex2html495 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html489 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035100000000000000> Creating A TixSelect Widget<A NAME=151> </A></A></H3>
|
||||
<P>
|
||||
Program 1-11 shows how to create a TixSelect
|
||||
widget. At line 1 of program 1-11, we create a
|
||||
TixSelect using the the <tt>tixSelect</tt> command.
|
||||
<P>
|
||||
<tt> tixSelect .fruits -label "Fruits: " -orientation horizontal<BR>
|
||||
.fruits add apple -text Apple -width 6<BR>
|
||||
.fruits add orange -text Orange -width 6<BR>
|
||||
.fruits add banana -text Banana -width 6<BR>
|
||||
pack .fruits
|
||||
</tt>
|
||||
<P><CENTER>(Figure 1-11) Creating a TixSelect Widget<A NAME=111> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
47
docs/html/TixBook/subsubsection3_3_5_5.html
Normal file
47
docs/html/TixBook/subsubsection3_3_5_5.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<HEAD>
|
||||
<TITLE> Specifying Selection Rules<A NAME=152> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html540 HREF=subsubsection3_3_5_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html538 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html532 HREF=subsubsectionstar3_3_5_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html542 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html541 HREF=subsubsection3_3_5_6.html> Accessing the Value </A>
|
||||
<B>Up:</B> <A NAME=tex2html539 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html533 HREF=subsubsectionstar3_3_5_4.html> Accessing the Button </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035500000000000000> Specifying Selection Rules<A NAME=152> </A></A></H3>
|
||||
<P>
|
||||
For simple selection rules, you can use the <tt>-allowzero</tt> and <tt>-radio</tt> options. The <tt>-allowzero</tt> option specifies whether the user
|
||||
can select none of the choices inside the TixSelect widget. The <tt>-radio</tt> option controls how many buttons can be selected at once: when
|
||||
set to true, the user can select only one button at a time; when set to
|
||||
false, the user can select as many buttons as he desires.
|
||||
<P>
|
||||
With these two options, we can write a program using two TixSelect widgets
|
||||
for little Jimmy to fill up his lunch box. On the Sandwich side, we set
|
||||
<tt>-radio</tt> to true and <tt>-allowzero</tt> <tt>false</tt>. That means Jimmy
|
||||
can select one and only one sandwich among beef, cheese or ham
|
||||
sandwiches. On the Veggie side, we want to encourage Jimmy to consume as
|
||||
much veggie as possible, so we set the <tt>-allowzero</tt> option to <tt>false</tt>. We also set the <tt>-allowzero</tt> option to <tt>false</tt> so that
|
||||
Jimmy cannot get away with eating none of the vegetables (see program
|
||||
1-13).
|
||||
<P>
|
||||
<blockquote> <tt> tixSelect .sandwich -allowzero false -radio true -label "Sandwich :"<BR>
|
||||
.sandwich add beef -text Beef<BR>
|
||||
.sandwich add cheese -text Cheese<BR>
|
||||
.sandwich add ham -text Ham<BR>
|
||||
<BR>
|
||||
tixSelect .vege -allowzero false -radio false -label "Vegetable :"<BR>
|
||||
.vege add bean -text Bean<BR>
|
||||
.vege add carrot -text Carrot<BR>
|
||||
.vege add lettuce -text Lettuce
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P><CENTER>(Figure 1-13) Specifying Simple Selection Rules<A NAME=113> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
36
docs/html/TixBook/subsubsection3_3_5_6.html
Normal file
36
docs/html/TixBook/subsubsection3_3_5_6.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<HEAD>
|
||||
<TITLE> Accessing the Value of a TixSelect Widget<A NAME=153> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html551 HREF=subsubsection3_3_5_7.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html549 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html543 HREF=subsubsection3_3_5_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html553 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html552 HREF=subsubsection3_3_5_7.html> Specifying Complex Selection </A>
|
||||
<B>Up:</B> <A NAME=tex2html550 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html544 HREF=subsubsection3_3_5_5.html> Specifying Selection Rules</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035600000000000000> Accessing the Value of a TixSelect Widget<A NAME=153> </A></A></H3>
|
||||
<P>
|
||||
The <em>value</em> of a TixSelect widget is a list of the names of the
|
||||
button subwidgets that are currently selected. For example, in
|
||||
program 1-11, if the user has selected the apple
|
||||
button, then the value of the TixSelect widget will be <tt>apple</tt>. If the user has selected both the apple and the orange
|
||||
buttons, then the value will be the list <tt>"apple orange"</tt>.
|
||||
<P>
|
||||
The TixSelect widget supports same set of options as the TixControl widget
|
||||
for you to access its value: the <tt>-value</tt> option stores the current
|
||||
value, which can be queried and modified using the cget and configure
|
||||
methods. You can also use the <tt>-variable</tt> option to specify a global
|
||||
variable to store the value of the TixSelect widget. The <tt>-command</tt>
|
||||
option specifies a TCL command to be called whenever the user changes the
|
||||
selection inside a TixSelect widget. This command is called with one
|
||||
argument: the new value of the TixSelect widget. There is also the <tt>-disablecallback</tt> option which you can use to control whether the command
|
||||
specified by the <tt>-command</tt> option should be called when the value of
|
||||
the TixSelect changes.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
51
docs/html/TixBook/subsubsection3_3_5_7.html
Normal file
51
docs/html/TixBook/subsubsection3_3_5_7.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<HEAD>
|
||||
<TITLE> Specifying Complex Selection Rules<A NAME=154> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html560 HREF=section3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html558 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html554 HREF=subsubsection3_3_5_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html562 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html561 HREF=section3_4.html> Container Widgets</A>
|
||||
<B>Up:</B> <A NAME=tex2html559 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html555 HREF=subsubsection3_3_5_6.html> Accessing the Value </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035700000000000000> Specifying Complex Selection Rules<A NAME=154> </A></A></H3>
|
||||
<P>
|
||||
If you want to have more complex selection rules for the
|
||||
TixSelect widget, you can use the <tt>-validatecmd</tt> option. This
|
||||
option works the same as the <tt>-validatecmd</tt> option of the
|
||||
TixControl widget which we discusses in section
|
||||
1.2: it specifies a command to be called every
|
||||
time the user attempts to change the selection inside a TixSelect
|
||||
widget.
|
||||
<P>
|
||||
In the example program 1-14, the procedure
|
||||
<tt>TwoMax</tt> will be called every time the user tries to change the
|
||||
selection of the <tt>.fruits</tt> widget. <tt>TwoMax</tt> limits the
|
||||
maximum number of fruits that the user to choose to be 2 by always
|
||||
truncating the value of the TixSelect widget to have no more than
|
||||
two items. If you run this program, you will find out that you can
|
||||
never select a third fruit after you have select two fruits.
|
||||
<P>
|
||||
<tt> tixSelect .fruits -label "Fruits: " -radio false -validatecmd TwoMax<BR>
|
||||
.fruits add apple -text Apple -width 6<BR>
|
||||
.fruits add orange -text Orange -width 6<BR>
|
||||
.fruits add banana -text Banana -width 6<BR>
|
||||
pack .fruits<BR>
|
||||
<BR>
|
||||
proc TwoMax {value} {<BR>
|
||||
if {[llength $value] $>$ 2} {<BR>
|
||||
return [lrange $value 0 1]<BR>
|
||||
} else {<BR>
|
||||
return $value<BR>
|
||||
}<BR>
|
||||
}</tt>
|
||||
<P><CENTER>(Figure 1-14) Specifying More Complex Selection Rules<A NAME=114> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
50
docs/html/TixBook/subsubsection3_4_1_1.html
Normal file
50
docs/html/TixBook/subsubsection3_4_1_1.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<HEAD>
|
||||
<TITLE> Adding Pages to a TixNoteBook<A NAME=211> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html610 HREF=subsubsection3_4_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html608 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html602 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html612 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html611 HREF=subsubsection3_4_1_2.html> Keyboard Accelerators</A>
|
||||
<B>Up:</B> <A NAME=tex2html609 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<B> Previous:</B> <A NAME=tex2html603 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00041100000000000000> Adding Pages to a TixNoteBook<A NAME=211> </A></A></H3>
|
||||
<P>
|
||||
The example program in figure 2-2 creates the
|
||||
TixNoteBook widget shown in figure 2-1. In the first
|
||||
three lines, we create the notebook widget and two pages inside
|
||||
it. While we create the pages, we also set the labels on the tabs
|
||||
associated with each page and use the <tt>-underline</tt> option to
|
||||
indicate the keyboard accelerator for each page.
|
||||
<P>
|
||||
Each time we create a page in the notebook using the <tt>add</tt> method, a
|
||||
frame subwidget is created for us automatically. This frame subwidget has
|
||||
the same name as the page (the first parameter passed to the <tt>add</tt>
|
||||
method). We can use the <tt>subwidget</tt> method to find out the pathname
|
||||
of this frame subwidget and pack everything we want to display on the
|
||||
page into this frame widget. Lines 4-10 of program 2-2 shows
|
||||
how to create the widgets inside the ``Hard Disk'' page. Creating the
|
||||
widgets inside the ``Network'' page will be similar.
|
||||
<P>
|
||||
<blockquote> <P><tt> tixNoteBook .n<BR>
|
||||
.n add hd -label "Hard Disk" -underline 0<BR>
|
||||
.n add net -label "Network" -underline 0<BR>
|
||||
<BR>
|
||||
set frame [.n subwidget hd]<BR>
|
||||
tixControl $frame.access -label "Access Time:"<BR>
|
||||
tixControl $frame.write -label "Write Throughput:"<BR>
|
||||
tixControl $frame.read -label "Read Througput:"<BR>
|
||||
tixControl $frame.capacity -label "Capacity:"<BR>
|
||||
pack $frame.access $frame.write $frame.read $frame.capacity <BR> -side top -fill x
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 2-2) Using The TixNoteBook Widget<A NAME=22> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
29
docs/html/TixBook/subsubsection3_4_1_2.html
Normal file
29
docs/html/TixBook/subsubsection3_4_1_2.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<HEAD>
|
||||
<TITLE> Keyboard Accelerators<A NAME=212> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html621 HREF=subsubsection3_4_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html619 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html613 HREF=subsubsection3_4_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html623 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html622 HREF=subsubsection3_4_1_3.html> Delaying the Creation </A>
|
||||
<B>Up:</B> <A NAME=tex2html620 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<B> Previous:</B> <A NAME=tex2html614 HREF=subsubsection3_4_1_1.html> Adding Pages to </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00041200000000000000> Keyboard Accelerators<A NAME=212> </A></A></H3>
|
||||
<P>
|
||||
Note that in line 2-3 of program 2-2, we have indicated
|
||||
the keyboard accelerators for the two pages using the <tt>-underline</tt> option. The value of this option is the position of the
|
||||
character to be underlined in the string, where zero represents the
|
||||
first character. When the user presses <tt>$<$Alt-N$>$</tt> or <tt>$<$Meta-N$>$</tt> the ``Network'' page will be activated; on the other hand,
|
||||
if he presses <tt>$<$Alt-H$>$</tt> or <tt>$<$Meta-H$>$</tt> the ``Hard Disk'' page
|
||||
will be activated. The TixNoteBook widget will automatically create
|
||||
the keyboard bindings for these accelerators for us, in a way
|
||||
similar to what the menu widget does, so there is no need to set the
|
||||
keyboard bindings ourself.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
59
docs/html/TixBook/subsubsection3_4_1_3.html
Normal file
59
docs/html/TixBook/subsubsection3_4_1_3.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<HEAD>
|
||||
<TITLE> Delaying the Creation of New Pages<A NAME=213> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html632 HREF=subsubsection3_4_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html630 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html624 HREF=subsubsection3_4_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html634 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html633 HREF=subsubsection3_4_1_4.html> Changing Page Tabs </A>
|
||||
<B>Up:</B> <A NAME=tex2html631 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<B> Previous:</B> <A NAME=tex2html625 HREF=subsubsection3_4_1_2.html> Keyboard Accelerators</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00041300000000000000> Delaying the Creation of New Pages<A NAME=213> </A></A></H3>
|
||||
<P>
|
||||
If your notebook contains many complicated pages, it may take quite a
|
||||
while to create all widgets inside these pages and your program will
|
||||
probably freezes for a few seconds when it pops up the notebook for
|
||||
the first time. To avoid embarrassing moments like this, we can use
|
||||
the ``delayed page creation'' feature of the TixNoteBook widget.
|
||||
<P>When we create a page using the <tt>add</tt> method, we can specify
|
||||
the optional parameter <tt>-createcmd</tt> so that we only need to
|
||||
create the page when the user wants to see it. This is illustrated
|
||||
in program 2-3:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixNoteBook .n<BR>
|
||||
.n add hd -label "Hard Disk" -underline 0 -createcmd CreateHd<BR>
|
||||
.n add net -label "Network" -underline 0 -createCmd CreateNet<BR>
|
||||
<BR>
|
||||
proc CreateHd {frame} {<BR>
|
||||
tixControl $frame.access -label "Access Time:"<BR>
|
||||
tixControl $frame.write -label "Write Throughput:"<BR>
|
||||
tixControl $frame.read -label "Read Througput:"<BR>
|
||||
tixControl $frame.capacity -label "Capacity:"<BR>
|
||||
pack $frame.access $frame.write $frame.read $frame.capacity <BR> -side top -fill x<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
proc CreateNet {frame} {<BR>
|
||||
...<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
<P>
|
||||
<P><CENTER>(Figure 2-3) Delayed Page Creation<A NAME=23> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
In line 2 of program 2-3, we use the <tt>-createcmd</tt>
|
||||
option to specify that the procedure <tt>CreateHd</tt> should be called
|
||||
when the ``Hard Disk'' page needs to be created. <tt>CreateHd</tt>
|
||||
takes one argument, the frame subwidget of the page. As we can see,
|
||||
program program 2-3 is not very different than program
|
||||
2-2, except now we can issue less commands during the
|
||||
set-up of the NoteBook widget and the interface can be started up
|
||||
more quickly.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
30
docs/html/TixBook/subsubsection3_4_1_4.html
Normal file
30
docs/html/TixBook/subsubsection3_4_1_4.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<HEAD>
|
||||
<TITLE> Changing Page Tabs and Deleting Pages<A NAME=214> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html641 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html639 HREF=subsection3_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html635 HREF=subsubsection3_4_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html643 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html642 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<B>Up:</B> <A NAME=tex2html640 HREF=subsection3_4_1.html> TixNoteBook</A>
|
||||
<B> Previous:</B> <A NAME=tex2html636 HREF=subsubsection3_4_1_3.html> Delaying the Creation </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00041400000000000000> Changing Page Tabs and Deleting Pages<A NAME=214> </A></A></H3>
|
||||
<P>
|
||||
To change the information in the tabs of the pages, we can use the
|
||||
<tt>pageconfigure</tt> method. For example, the following command:
|
||||
<P><blockquote> <P><tt> .nb pageconfigure hd -label "Fixed Disk"
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>changes the label from ``Hard Disk'' to ``Fixed Disk''. To delete a
|
||||
page, we can use the <tt>delete</tt> method.
|
||||
<P>You should avoid using the <tt>pageconfigure</tt> and <tt>delete</tt>. Your users will just feel annoyed if the interface changes
|
||||
all the time and notebook pages appear and disappear every now and
|
||||
then.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
59
docs/html/TixBook/subsubsection3_4_2_1.html
Normal file
59
docs/html/TixBook/subsubsection3_4_2_1.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<HEAD>
|
||||
<TITLE> Adding Panes Inside a TixPanedWindow Widget<A NAME=221> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html667 HREF=subsubsection3_4_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html665 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html659 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html669 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html668 HREF=subsubsection3_4_2_2.html> Putting Widgets Inside </A>
|
||||
<B>Up:</B> <A NAME=tex2html666 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<B> Previous:</B> <A NAME=tex2html660 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00042100000000000000> Adding Panes Inside a TixPanedWindow Widget<A NAME=221> </A></A></H3>
|
||||
<P>
|
||||
You can create a TixPanedWindow widget using the <tt>tixPanedWindow</tt>
|
||||
command. After that, you can add panes into this widget using the
|
||||
<tt>add</tt> method (see program 2-5).
|
||||
<P>When you use the <tt>add</tt> method, there are several optional
|
||||
parameters which you can use to control the size of each of the
|
||||
pane. The <tt>-min</tt> parameter controls the minimum size of the pane
|
||||
and the <tt>-max</tt> parameter controls its maximum size. These two
|
||||
parameters controls how much the user can expand or shrink a
|
||||
pane. If neither is specified, then the pane can be expanded or
|
||||
shrunk without restrictions.
|
||||
<P>In addition, the -size parameter specifies the initial size of the
|
||||
pane. If it is not specified, then the initial size of the pane will
|
||||
be its natural size.
|
||||
<P>
|
||||
In program 2-5, we set the initial size of <tt>pane1</tt> to
|
||||
100 pixels using the -size parameter. We don't set the <tt>-size</tt>
|
||||
parameter for <tt>pane2</tt> so it will appear in its natural
|
||||
size. However, we use the <tt>-max</tt> option for <tt>pane2</tt> so that
|
||||
the user can never expand the size of <tt>pane2</tt> to more than 300
|
||||
pixels.
|
||||
<P>
|
||||
<blockquote> <P><tt> tixPanedWindow .p<BR>
|
||||
.p add pane1 -size 100<BR>
|
||||
.p add pane2 -max 300<BR>
|
||||
<BR>
|
||||
set p1 [.p subwidget pane1]<BR>
|
||||
button $p1.b1 -text Button1<BR>
|
||||
button $p1.b2 -text Button2<BR>
|
||||
pack $p1.b1 $p1.b2 -side left -expand yes<BR>
|
||||
<BR>
|
||||
set p2 [.p subwidget pane2]<BR>
|
||||
button $p2.b -text "Another Button"<BR>
|
||||
pack $p2.b -side left -expand yes -fill both<BR>
|
||||
<BR>
|
||||
pack .p -expand yes -fill both
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 2-5) Adding Panes into a TixPanedWindow Widget<A NAME=25> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_4_2_2.html
Normal file
31
docs/html/TixBook/subsubsection3_4_2_2.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Putting Widgets Inside the Panes<A NAME=222> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html678 HREF=subsubsection3_4_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html676 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html670 HREF=subsubsection3_4_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html680 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html679 HREF=subsubsection3_4_2_3.html> Setting the Order </A>
|
||||
<B>Up:</B> <A NAME=tex2html677 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<B> Previous:</B> <A NAME=tex2html671 HREF=subsubsection3_4_2_1.html> Adding Panes Inside </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00042200000000000000> Putting Widgets Inside the Panes<A NAME=222> </A></A></H3>
|
||||
<P>
|
||||
Each pane we have created using the <tt>add</tt> method is essentially
|
||||
a frame widget. After we have created the panes, we can put widgets
|
||||
inside them. As shown inside program 2-5, we can use the
|
||||
<tt>subwidget</tt> method to find out the name of the pane
|
||||
subwidgets. Then we can just create new widgets as their children
|
||||
and pack these new widgets inside the panes. The output of program
|
||||
2-5 is shown in figure 2-6
|
||||
<P>
|
||||
<blockquote> <P><P><CENTER><IMG SRC="../gif/tix/container/pane_add.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
32
docs/html/TixBook/subsubsection3_4_2_3.html
Normal file
32
docs/html/TixBook/subsubsection3_4_2_3.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<HEAD>
|
||||
<TITLE> Setting the Order of the Panes<A NAME=223> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html689 HREF=subsubsection3_4_2_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html687 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html681 HREF=subsubsection3_4_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html691 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html690 HREF=subsubsection3_4_2_4.html> Changing the Sizes </A>
|
||||
<B>Up:</B> <A NAME=tex2html688 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<B> Previous:</B> <A NAME=tex2html682 HREF=subsubsection3_4_2_2.html> Putting Widgets Inside </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00042300000000000000> Setting the Order of the Panes<A NAME=223> </A></A></H3>
|
||||
<P>
|
||||
Usually, when you create a new pane, it is always added to the
|
||||
bottom or right of the list of panes. If you want to control the
|
||||
order in which the panes appear inside the TixPanedWindow widget,
|
||||
you can use the two optional parameters, <tt>-before</tt> and <tt>-after</tt>, for the <tt>add</tt> method. For example, the call:
|
||||
<P><blockquote> <P><tt> .p add pane2 -after pane1
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
will place the new pane immediately after <tt>pane1</tt>. The call:
|
||||
<blockquote> <P><tt> .p add pane2 -before pane1
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
will place the new pane immediately in front of <tt>pane1</tt>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
33
docs/html/TixBook/subsubsection3_4_2_4.html
Normal file
33
docs/html/TixBook/subsubsection3_4_2_4.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<HEAD>
|
||||
<TITLE> Changing the Sizes of the Panes<A NAME=224> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html698 HREF=subsection3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html696 HREF=subsection3_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html692 HREF=subsubsection3_4_2_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html700 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html699 HREF=subsection3_4_3.html> The Family of </A>
|
||||
<B>Up:</B> <A NAME=tex2html697 HREF=subsection3_4_2.html> PanedWindow</A>
|
||||
<B> Previous:</B> <A NAME=tex2html693 HREF=subsubsection3_4_2_3.html> Setting the Order </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00042400000000000000> Changing the Sizes of the Panes<A NAME=224> </A></A></H3>
|
||||
<P>
|
||||
If you want to change the sizes of the existing panes or change
|
||||
their maximum/minimum size constraints, you can use the
|
||||
<tt>paneconfigure</tt> method. For example, the following code changes the
|
||||
size of <tt>pane2</tt> to 100 pixels and adjusts its minimum size
|
||||
constraint to no less than 10 pixels:
|
||||
<P>
|
||||
<blockquote> <P><tt> .p paneconfigure pane2 -size 100 -min 10
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
Notice that after you call the <tt>paneconfigure</tt> method, the
|
||||
PanedWindow may jitter and that may annoy the user. Therefore, use
|
||||
this method only when it is necessary.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
58
docs/html/TixBook/subsubsection3_4_3_1.html
Normal file
58
docs/html/TixBook/subsubsection3_4_3_1.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<HEAD>
|
||||
<TITLE> The Scrolled Listbox Widget<A NAME=231> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html720 HREF=subsubsection3_4_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html718 HREF=subsection3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html712 HREF=subsection3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html722 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html721 HREF=subsubsection3_4_3_2.html> Other Scrolled Widgets</A>
|
||||
<B>Up:</B> <A NAME=tex2html719 HREF=subsection3_4_3.html> The Family of </A>
|
||||
<B> Previous:</B> <A NAME=tex2html713 HREF=subsection3_4_3.html> The Family of </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00043100000000000000> The Scrolled Listbox Widget<A NAME=231> </A></A></H3>
|
||||
<P>
|
||||
You can create a scrolled listbox widget using the <tt>tixScrolledListBox</tt>
|
||||
command. Notice that the widget created by the <tt>tixScrolledListBox</tt>
|
||||
command is not itself a listbox widget. Rather, it is a frame widget
|
||||
which contains two scrollbar subwidgets: one is called <tt>hsb</tt> (the
|
||||
horizontal scrollbar) and the other is called <tt>vsb</tt> (the vertical
|
||||
scrollbar). Similarly, the listbox being scrolled is also a subwidget
|
||||
which is appropriately called <tt>listbox</tt>. Therefore, if we need to put
|
||||
things into the listbox (as we always do!), we can use the <tt>subwidget</tt> method. As shown in program 2-7, we first find
|
||||
the pathname of the <tt>listbox</tt> subwidget by calling ``<tt>.sl
|
||||
subwidget listbox</tt>''. Then, we insert some items into the <tt>listbox</tt>
|
||||
subwidget.
|
||||
<P>
|
||||
<P><blockquote> <P><tt> tixScrolledListBox .sl -scrollbar auto<BR>
|
||||
set listbox [.sl subwidget listbox]<BR>
|
||||
<BR>
|
||||
for {set x 0} {$x $<$ 6} {incr x} {<BR>
|
||||
$listbox insert end "This is item $x"<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
pack .sl -side left -expand yes -fill both
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 2-7) Scrolled Listbox Widget<A NAME=27> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/container/sl-nobar.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/container/sl-bar.gif"><BR CLEAR=LEFT><CENTER>(Figure 2-8) Scrolled ListBox with Automatic Scrollbars<A NAME=28> </A></CENTER><P>
|
||||
</CENTER>
|
||||
<P>
|
||||
Also, as seen in the first line of program 2-7, we use
|
||||
the <tt>-scrollbar</tt> option to control the scrolling policy of the
|
||||
TixScrolledListBox widget. Usually, we'll set it to ``<tt>auto</tt>'':
|
||||
the scrollbars are displayed only if they are needed. Other possible
|
||||
values are ``<tt>both</tt>'': the two scrollbars are always displayed;
|
||||
``<tt>x</tt>'': the horizontal scrollbar is always displayed, while the
|
||||
vertical scrollbar is always hidden; ``<tt>y</tt>'': the opposite of
|
||||
``<tt>x</tt>''; ``<tt>none</tt>'': the two scrollbars are always
|
||||
hidden. The result of program 2-7 is shown in figure
|
||||
2-8.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
62
docs/html/TixBook/subsubsection3_4_3_2.html
Normal file
62
docs/html/TixBook/subsubsection3_4_3_2.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<HEAD>
|
||||
<TITLE> Other Scrolled Widgets<A NAME=232> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html729 HREF=section3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html727 HREF=subsection3_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html723 HREF=subsubsection3_4_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html731 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html730 HREF=section3_5.html> Tabular Listbox and </A>
|
||||
<B>Up:</B> <A NAME=tex2html728 HREF=subsection3_4_3.html> The Family of </A>
|
||||
<B> Previous:</B> <A NAME=tex2html724 HREF=subsubsection3_4_3_1.html> The Scrolled Listbox </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00043200000000000000> Other Scrolled Widgets<A NAME=232> </A></A></H3>
|
||||
<P>
|
||||
The <b>TixScrolledText</b> widget is very similar to the
|
||||
TixScrolledListBox widget, except it scrolls a text subwidget, which
|
||||
is called <tt>text</tt>. One problem with the TixScrolledText widget,
|
||||
though, is its <tt>-scrollbar</tt> option doesn't work in the <b>auto</b> mode. This is due to a bug in Tk which doesn't report the
|
||||
width of the <b>text</b> subwidget correctly. Until this bug is fixed
|
||||
in TK, the <b>auto</b> mode will behave the same way as the both mode
|
||||
for the TixScrolledText widget.
|
||||
<P>
|
||||
Another scrolled-widget is <b>TixScrolledWindow</b>. Sometimes you have a
|
||||
large number of widgets that can't possibly be shown in the screen all at
|
||||
once and your application doesn't allow you to divide the widgets into
|
||||
several pages of a TixNoteBook. In this case you can use
|
||||
TixScrolledWindow. It contains a frame subwidget called <tt>window</tt>. You
|
||||
can just create as many widgets as you need as children of the <tt>window</tt> subwidget. An example is shown in program 2-9, which uses the
|
||||
TixScrolledWindow widget to implement a ``cheap'' spreadsheet
|
||||
application. The boxes of the spreadsheet are just entry widgets and they
|
||||
are packed inside the <tt>window</tt> subwidget. The user will be able to
|
||||
scroll to different parts of the spreadsheet if it is too large to fit in
|
||||
one screen.
|
||||
<P>
|
||||
<blockquote> <P><tt> tixScrolledWindow .sw -scrollbar auto<BR>
|
||||
set f [.sw subwidget window]<BR>
|
||||
<BR>
|
||||
for {set x 0} {$x $<$ 10} {incr x} {<BR>
|
||||
frame $f.f$x<BR>
|
||||
pack $f.f$x -side top -expand yes -fill both<BR>
|
||||
for {set y 0} {$y $<$ 10} {incr y} {<BR>
|
||||
entry $f.f$x.e$y -width 10<BR>
|
||||
pack $f.f$x.e$y -side left -fill x<BR>
|
||||
}<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
pack .sw -side left -expand yes -fill both
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 2-9) Cheap Spreadsheet Application with TixScrolledWindow<A NAME=29> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
There are two more scrolled-widgets in the Tix library: <b>TixScrolledTList</b> scrolls a TixTList widget and <b>TixScrolledHList</b>
|
||||
scrolls a TixHList widget. The subwidgets that they scroll are called
|
||||
<tt>tlist</tt> and <tt>hlist</tt>, respectively. The use of the TList and HList
|
||||
widgets will be described in the next chapters.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
47
docs/html/TixBook/subsubsection3_5_2_1.html
Normal file
47
docs/html/TixBook/subsubsection3_5_2_1.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<HEAD>
|
||||
<TITLE> Advantages of Display Items<A NAME=321> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html786 HREF=subsubsection3_5_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html784 HREF=subsection3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html778 HREF=subsection3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html788 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html787 HREF=subsubsection3_5_2_2.html> Display Items and </A>
|
||||
<B>Up:</B> <A NAME=tex2html785 HREF=subsection3_5_2.html> Display Items</A>
|
||||
<B> Previous:</B> <A NAME=tex2html779 HREF=subsection3_5_2.html> Display Items</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00052100000000000000> Advantages of Display Items<A NAME=321> </A></A></H3>
|
||||
<P>
|
||||
It is easy to see the advantages of seperating the display items from their
|
||||
host widgets. First, the display items are easy to learn. Since they are
|
||||
the same across different types of widgets. Once you learn about a type
|
||||
of display items, you will know how to use them in all Tix widgets that
|
||||
support display items (currently these include TixHList, TixTList and the
|
||||
spreadsheet widget TixGrid, but the number is growing). In contrast, if
|
||||
you want to create a text item for the Tk widgets, you will find out that
|
||||
the listbox, text, canvas and entry widget each have a different method
|
||||
of creating and manipulating text items, and it is quite annoying to
|
||||
learn each of them individually.
|
||||
<P>
|
||||
Second, the hosts widgets that use display items are extensible.
|
||||
Because of the separation of task, the host widgets are not involved
|
||||
in the implementation details of the display items. Therefore, if
|
||||
you add a new type of display items, such as a <tt>animation</tt> type
|
||||
that displays live video, the host widgets will gladly take them in
|
||||
and display them. You don't need to modify the existing host widgets
|
||||
at all. In contrast, if you want to display graphical images in the
|
||||
existing Tk listbox widgets, you'd better set aside 100 hours to
|
||||
rewrite it completely!
|
||||
<P>
|
||||
Third, display items are good for writers of host widgets. Because
|
||||
now they just need to implement the arrangement policy of the host
|
||||
widgets. They don't need to worry about drawing at all because it is
|
||||
all handled by the display items. This is a significant saving in
|
||||
code because a widget that does not use display items has to spend
|
||||
30%of its C code to do the drawing.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
55
docs/html/TixBook/subsubsection3_5_2_2.html
Normal file
55
docs/html/TixBook/subsubsection3_5_2_2.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<HEAD>
|
||||
<TITLE> Display Items and Display Styles<A NAME=322> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html795 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html793 HREF=subsection3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html789 HREF=subsubsection3_5_2_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html797 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html796 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B>Up:</B> <A NAME=tex2html794 HREF=subsection3_5_2.html> Display Items</A>
|
||||
<B> Previous:</B> <A NAME=tex2html790 HREF=subsubsection3_5_2_1.html> Advantages of Display </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00052200000000000000> Display Items and Display Styles<A NAME=322> </A></A></H3>
|
||||
<P>
|
||||
The appearance of a display item is controlled by a set of
|
||||
attributes. For example, the <tt>text</tt> attribute controls the text
|
||||
string displayed on the item and the <tt>font</tt> attribute specifies
|
||||
what font should be used.
|
||||
<P>
|
||||
Usually, each of the attributes falls into one of two categroies:
|
||||
``<em>individual</em>'' or ``<em>collective</em>''. For example, each of
|
||||
the items inside a TixTList widget may display a different text
|
||||
string; therefore we call the text string an <em>individual
|
||||
attribute</em>. However, in most cases, the items share the same color,
|
||||
font and spacing and we call these <em>collective attributes</em>.
|
||||
<P>
|
||||
One question concerns where we keep the collective attribute for the
|
||||
display items. Certainly, we can keep a <tt>font</tt> attribute for each
|
||||
item, but this is not really an efficient solution. In fact, if all the
|
||||
items have the same font, we would be keeping a duplicated copy of the
|
||||
same font for each of the items we create. Since a host widget may have
|
||||
many thousands of items, keeping thousands of dupilcated copys of the
|
||||
same font, or any other collective attributes, would be very wasteful.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/tlist/relation.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
To avoid the unnecessary duplication of resources, Tix stores the
|
||||
collective attributes in special objects called <em>display styles</em>. The
|
||||
relationship between display items and their styles is depicted in figure
|
||||
3-4. Each item holds its own copy of the individual
|
||||
attributes, such as <tt>text</tt>. However, the collective attributes are
|
||||
stored in the style objects. Each item has a special <tt>style</tt>
|
||||
attribute that tells it which style it should use. In figure 3-4
|
||||
, since items <em>a</em> and <em>b</em> are assigned the same
|
||||
style, therefore, they share the same font and color. Item <em>c</em> is
|
||||
assigned a different style, thus, it uses a different font than <em>a</em>
|
||||
and <em>b</em>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
47
docs/html/TixBook/subsubsection3_5_3_1.html
Normal file
47
docs/html/TixBook/subsubsection3_5_3_1.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating Display Items<A NAME=331> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html821 HREF=subsubsection3_5_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html819 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html813 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html823 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html822 HREF=subsubsection3_5_3_2.html> Setting the Styles </A>
|
||||
<B>Up:</B> <A NAME=tex2html820 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html814 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053100000000000000> Creating Display Items<A NAME=331> </A></A></H3>
|
||||
<P>
|
||||
Now it's time to put our knowledge about host widgets, display items
|
||||
and display styles into practice. The following example code creates
|
||||
two items in a TixTList widget using the <tt>insert</tt> method:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixTList .t<BR>
|
||||
pack .t<BR>
|
||||
<BR>
|
||||
.t insert end -itemtype text -text "First Item" -underline 0<BR>
|
||||
.t insert end -itemtype text -text "Second Item" -underline 0<BR>
|
||||
<BR>
|
||||
set picture [image create bitmap -file picture.xbm]<BR>
|
||||
.t insert end -itemtype image -image $picture</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
As we can see, the <tt>insert</tt> method of TixTList is very similar to the
|
||||
<tt>insert</tt> method of the standard Tk listbox widget: it inserts a new
|
||||
item into the TixTList widget. The first argument it takes is the
|
||||
location of the new item. For example <tt>0</tt> indicates the first
|
||||
location in the list, <tt>1</tt> indicates the second location, and so
|
||||
on. Also the special keyword <tt>end</tt> indicates the end of the list.
|
||||
<P>
|
||||
Then, we can use the <tt>-itemtype</tt> switch to specify the type of
|
||||
display item we want to create. There are currently four types of items
|
||||
to choose from: <tt>text</tt>, <tt>image</tt>, <tt>imagetext</tt> and <tt>window</tt>. In the above example, we create two items of the type <tt>text</tt>
|
||||
and one item of the type <tt>image</tt>. The subsequent arguments to the
|
||||
<tt>insert</tt> method set the configuration options of the individual
|
||||
attributes of the new item.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
75
docs/html/TixBook/subsubsection3_5_3_2.html
Normal file
75
docs/html/TixBook/subsubsection3_5_3_2.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<HEAD>
|
||||
<TITLE> Setting the Styles of the Display Items<A NAME=332> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html832 HREF=subsubsection3_5_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html830 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html824 HREF=subsubsection3_5_3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html834 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html833 HREF=subsubsection3_5_3_3.html> Configuring and Deleting </A>
|
||||
<B>Up:</B> <A NAME=tex2html831 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html825 HREF=subsubsection3_5_3_1.html> Creating Display Items</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053200000000000000> Setting the Styles of the Display Items<A NAME=332> </A></A></H3>
|
||||
<P>
|
||||
Note that in the above example, if we want to control the foreground color
|
||||
of the text items, we cannot issue commands such as:
|
||||
<P>
|
||||
<blockquote> <tt> .t insert end -itemtype text -text "First Item" -foreground black
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
because <tt>-foreground</tt> is not an individual attribute of the text
|
||||
item. Instead, it is a collective attribute and must be accessed using a
|
||||
display style object. To do that we can use the command <tt>tixItemStyle</tt> to create display styles, as shown in the following
|
||||
example:
|
||||
<P>
|
||||
<blockquote> <P><tt> set style1 [tixDisplayStyle text -font 8x13]<BR>
|
||||
set style2 [tixDisplayStyle text -font 8x13bold]<BR>
|
||||
<BR>
|
||||
tixTList .t; pack .t<BR>
|
||||
<BR>
|
||||
.t insert end -itemtype text -text "First Item" -underline 0 <BR> -style $style1<BR>
|
||||
.t insert end -itemtype text -text "Second Item" -underline 0 <BR> -style $style2<BR>
|
||||
.t insert end -itemtype text -text "Third Item" -underline 0 <BR> -style $style1</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
The first argument of <tt>tixDisplayStyle</tt> specify the type of style we
|
||||
want to create. Each type of display item needs its own type of display
|
||||
styles. Therefore, for example, we cannot create a style of type <tt>text</tt> and assign it to an item of type <tt>image</tt>. The subsequent
|
||||
arguments to <tt>tixDisplayStyle</tt> set the configuration options of the
|
||||
collective attributes defined by this style. A complete list of the
|
||||
configuration options of each type of the display style is in figures ???
|
||||
through ???.
|
||||
<P>
|
||||
The <tt>tixDisplayStyle</tt> command returns the names of the newly created
|
||||
styles to us and we use the variables <tt>style1</tt> and <tt>style2</tt> to
|
||||
store these names. We can then assign the styles to the display items by
|
||||
using the names of the styles. As shown in figure 3-5, by
|
||||
assing these two styles to the <tt>-style</tt> option of the display items,
|
||||
we assigned a medium-weight font to the first and third item and a bold
|
||||
font to the second item.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/tlist/twofont.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/tlist/twofont2.gif"><BR CLEAR=LEFT><CENTER>(Figure 3-5) Two Display Styles With Different Fonts<A NAME=35> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
The name of the style returned by <tt>tixDisplayStyle</tt> is also the name
|
||||
of a command which we can use to control the style. For example, we can
|
||||
use the following commands to switch the fonts in the two styles we
|
||||
created in the above example:
|
||||
<P>
|
||||
<blockquote> <P><tt> $style1 configure -font 8x13bold<BR>
|
||||
$style2 configure -font 8x13
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
After the execution of the above command, the font in the second item in
|
||||
the TixTList widget becomes medium-weight and the font in the first and
|
||||
third items becomes bold, as shown in figure 3-5.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_5_3_3.html
Normal file
31
docs/html/TixBook/subsubsection3_5_3_3.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Configuring and Deleting the Items<A NAME=333> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html843 HREF=subsubsection3_5_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html841 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html835 HREF=subsubsection3_5_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html845 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html844 HREF=subsubsection3_5_3_4.html> Choosing the Orientation </A>
|
||||
<B>Up:</B> <A NAME=tex2html842 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html836 HREF=subsubsection3_5_3_2.html> Setting the Styles </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053300000000000000> Configuring and Deleting the Items<A NAME=333> </A></A></H3>
|
||||
<P>
|
||||
You can configure the individual attributes of the items using the <tt>entryconfigure</tt> method. There is also the entrycget method for querying
|
||||
the attributes of the items. To <tt>delete</tt> the items, you can use the
|
||||
delete method. In the following example, we use these two methods to
|
||||
change the first and third items to display the text strings <tt>One</tt>
|
||||
and <tt>Two</tt> and change the third item to use the style <tt>$style2</tt>. Then we delete the second item using the <tt>delete</tt> command.
|
||||
<P>
|
||||
<blockquote> <P><tt> .t entryconfigure 0 -text One<BR>
|
||||
.t entryconfigure 2 -text Two<BR>
|
||||
.t delete 1
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
47
docs/html/TixBook/subsubsection3_5_3_4.html
Normal file
47
docs/html/TixBook/subsubsection3_5_3_4.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<HEAD>
|
||||
<TITLE> Choosing the Orientation and Number of Rows or Columns<A NAME=334> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html854 HREF=subsubsection3_5_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html852 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html846 HREF=subsubsection3_5_3_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html856 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html855 HREF=subsubsection3_5_3_5.html> Event Handling</A>
|
||||
<B>Up:</B> <A NAME=tex2html853 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html847 HREF=subsubsection3_5_3_3.html> Configuring and Deleting </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053400000000000000> Choosing the Orientation and Number of Rows or Columns<A NAME=334> </A></A></H3>
|
||||
<P>
|
||||
There are three options that controls the layout of the items in the
|
||||
TixTList widget. The <tt>-orientation</tt> option can be set to either
|
||||
vertical or horizontal. When <tt>-orientation</tt> is set to <tt>vertical</tt>,
|
||||
the items are laid out vertically from top down and wrapped to the next
|
||||
column when the bottom is reached (see figure 3-6). The opposite layout
|
||||
policy is chosen if <tt>-orientation</tt> is set to <tt>horizontal</tt> (see
|
||||
figure 3-6).
|
||||
<P>
|
||||
When the <tt>-orientation</tt> option is set to <tt>vertical</tt>, normally
|
||||
the number of columns displayed depends on the number of items in the
|
||||
TixTList widget: the more items there are, the more columns will there
|
||||
be. However, we can use the <tt>-columns</tt> option to control the number
|
||||
of columns: the items will be wrapped in a way so that the number of
|
||||
columns produced will be exactly as dicated by the <tt>-columns</tt> option.
|
||||
<P>
|
||||
One use of the <tt>-columns</tt> option is to specify the same layout
|
||||
policy as that of the standard Tk listbox widget. We can do this by
|
||||
setting <tt>-orientation</tt> to vertical and <tt>-columns</tt> to <tt>1</tt>. This way we can get a replacement listbox widget that can
|
||||
display multiple fonts and colors and graphics!
|
||||
<P>
|
||||
The counterpart of the <tt>-columns</tt> option is the <tt>-rows</tt> option,
|
||||
which is used for the same purpose when the <tt>-orientation</tt> option is
|
||||
set to <tt>horizontal</tt>.
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/tlist/vertical.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/tlist/horizontal.gif"><BR CLEAR=LEFT><CENTER>(Figure 3-6) The <tt>-orientation</tt> option of the TixSelect Widget<A NAME=36> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
29
docs/html/TixBook/subsubsection3_5_3_5.html
Normal file
29
docs/html/TixBook/subsubsection3_5_3_5.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<HEAD>
|
||||
<TITLE> Event Handling<A NAME=335> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html865 HREF=subsubsection3_5_3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html863 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html857 HREF=subsubsection3_5_3_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html867 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html866 HREF=subsubsection3_5_3_6.html> Selection</A>
|
||||
<B>Up:</B> <A NAME=tex2html864 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html858 HREF=subsubsection3_5_3_4.html> Choosing the Orientation </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053500000000000000> Event Handling<A NAME=335> </A></A></H3>
|
||||
<P>
|
||||
You can handle the events in a TList widget using the <tt>-browsecmd</tt> and
|
||||
<tt>-command</tt> options. The meanings of these two options are silimar to
|
||||
their meanings in other Tix widgets such as the ComboBox. Usually, the
|
||||
command specified by <tt>-browsecmd</tt> is called when the user clicks or
|
||||
drags the mouse over the items or presses the arrow keys. The command
|
||||
specified by <tt>-command</tt> is called when the user double-clicks or
|
||||
presses the Return key. These commands are called with one extra
|
||||
argument - the index of the currently ``active'' item, which is usually
|
||||
the item under the mouse cursor.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
33
docs/html/TixBook/subsubsection3_5_3_6.html
Normal file
33
docs/html/TixBook/subsubsection3_5_3_6.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<HEAD>
|
||||
<TITLE> Selection<A NAME=336> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html874 HREF=section3_6.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html872 HREF=subsection3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html868 HREF=subsubsection3_5_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html876 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html875 HREF=section3_6.html> Hierarchical Listbox</A>
|
||||
<B>Up:</B> <A NAME=tex2html873 HREF=subsection3_5_3.html> Creating Display Items </A>
|
||||
<B> Previous:</B> <A NAME=tex2html869 HREF=subsubsection3_5_3_5.html> Event Handling</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00053600000000000000> Selection<A NAME=336> </A></A></H3>
|
||||
<P>
|
||||
The <tt>-selectmode</tt> option controls how many items the user can select at
|
||||
one time. In the <tt>single</tt> and <tt>browse</tt> mode, the user can select
|
||||
only one item at a time. In the <tt>multiple</tt> and <tt>extended</tt> mode,
|
||||
the user can select multiple items; the <tt>extended</tt> mode allows
|
||||
disjoint selections while the <tt>multiple</tt> mode does not.
|
||||
<P>
|
||||
Normally, the user selects the items using the mouse or the
|
||||
keyboard. You can find out which items the user has selected with the
|
||||
<tt>info selection</tt> method, which returns a list of the currently
|
||||
selected items. You can also set the selection using the <tt>selection
|
||||
set</tt> method. For example, the command <tt>.tlist selection set 3</tt>
|
||||
selects the item whose index is <tt>3</tt>. The command <tt>.tlist
|
||||
selection set 2 10</tt> selects all the items at index <tt>2</tt> through <tt>10</tt>. The method <tt>selection clear</tt> empties the selection.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
55
docs/html/TixBook/subsubsection3_6_1_1.html
Normal file
55
docs/html/TixBook/subsubsection3_6_1_1.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating a Hierarchical List<A NAME=411> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html917 HREF=subsubsection3_6_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html915 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html909 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html919 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html918 HREF=subsubsection3_6_1_2.html> Creating Entries in </A>
|
||||
<B>Up:</B> <A NAME=tex2html916 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<B> Previous:</B> <A NAME=tex2html910 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00061100000000000000> Creating a Hierarchical List<A NAME=411> </A></A></H3>
|
||||
<P>
|
||||
A TixHList widget can be created by the command <tt>tixHList</tt>. However, most likely, you would want to create a TixHList
|
||||
with scrollbars attached. Therefore, usually you will use the <tt>tixScrolledHList</tt> command to create a scrolled hierarchical listbox
|
||||
(line 1 in program 4-2). The <tt>tixScrolledHList</tt>
|
||||
command is very similar to the <tt>TixScrolledListBox</tt> command we
|
||||
saw in section 2.3.1. It creates a TixHList subwidget
|
||||
of the name <tt>hlist</tt> and attaches two scrollbars to it.
|
||||
<P>
|
||||
As shown in the first five lines in program 4-2, we
|
||||
create a scrolled TixHList widget, using the <tt>-options</tt> switch
|
||||
(see section 1.3.5) to set several options for the <tt>hlist</tt> subwidget (we'll talk about these options shortly). Then, we
|
||||
can access the HList subwidget widget using the <tt>subwidget
|
||||
hlist</tt> method (line 7 in program 4-2).
|
||||
<P>
|
||||
<blockquote> <P><tt> tixScrolledHList .sh -options {<BR>
|
||||
hlist.itemType text<BR>
|
||||
hlist.drawBranch false<BR>
|
||||
hlist.indent 8<BR>
|
||||
}<BR>
|
||||
pack .sh -expand yes -fill both<BR>
|
||||
set hlist [.sh subwidget hlist]<BR>
|
||||
<BR>
|
||||
$hlist add foo -text "foo"<BR>
|
||||
$hlist add foo.bar -text "foo's 1st son"<BR>
|
||||
$hlist add foo.bor -text "foo's 2nd son"<BR>
|
||||
$hlist add foo.bar.bao -text "foo's 1st son's 1st son"<BR>
|
||||
$hlist add foo.bar.kao -text "foo's 1st son's 2nd son"<BR>
|
||||
$hlist add dor -text "dor, who has no son"
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 4-2) Creating Entries in a HList Widget<A NAME=42> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<P><blockquote> <P><P><CENTER><IMG SRC="../gif/tix/hlist/hlist_ex1.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
83
docs/html/TixBook/subsubsection3_6_1_2.html
Normal file
83
docs/html/TixBook/subsubsection3_6_1_2.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating Entries in a HList Widget<A NAME=412> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html928 HREF=subsubsection3_6_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html926 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html920 HREF=subsubsection3_6_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html930 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html929 HREF=subsubsection3_6_1_3.html> Controlling the Layout </A>
|
||||
<B>Up:</B> <A NAME=tex2html927 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<B> Previous:</B> <A NAME=tex2html921 HREF=subsubsection3_6_1_1.html> Creating a Hierarchical </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00061200000000000000> Creating Entries in a HList Widget<A NAME=412> </A></A></H3>
|
||||
<P>
|
||||
Each entry in an HList widget has a unique name, called its <em>entry-path</em>, which determines each entry's position in the HList
|
||||
widget. The entry-paths of the HList entries are very similar to the
|
||||
pathnames of Unix files. Each entry-path is a list of string names
|
||||
separated by a <em>separator character</em>. By default, the separator
|
||||
character is the period character (<tt>.</tt>), but it can be
|
||||
configured using the <tt>-separator</tt> option of the HList widget.
|
||||
<P>
|
||||
In program 4-3, we add several new entries <tt>foo</tt>,
|
||||
<tt>foo.bar</tt>, <tt>foo.bor</tt>, <tt>foo.bar.bao</tt>, .. etc, into the
|
||||
HList widget using the <tt>add</tt> method. The relationship between
|
||||
the entries is signified by their names, in a way similar to how
|
||||
Unix denotes directories and subdirectories. For example, <tt>foo</tt>
|
||||
is the <em>parent</em> of <tt>foo.bar</tt> and <tt>foo.bor</tt>; <tt>foo.bar</tt> is the parent of <tt>foo.bar.bao</tt>, and so on. As far as
|
||||
the terminology goes, we also say that <tt>foo.bar</tt> a <em>child</em>
|
||||
of <tt>foo</tt>; <tt>foo</tt> is an <em>ancestor</em> of <tt>foo.bar.bao</tt>
|
||||
and <tt>foo.bar.bao</tt> is a <em>descendant</em> of <tt>foo</tt>.
|
||||
<P>
|
||||
The output of program 4-2 is shown in figure
|
||||
4-3. As we can see, the entries are displayed under
|
||||
their parents with the amount of indentation control by the <tt>-indent</tt> option of the HList widget: <tt>foo.bar.bao</tt> and <tt>foo.bar.kao</tt> are display under <tt>foo.bar</tt>, which is in turn
|
||||
displayed under <tt>foo</tt>.
|
||||
<P>
|
||||
Entries with no parents, for example, <tt>foo</tt> and <tt>dor</tt> in
|
||||
program 4-2, are called <em>top-level
|
||||
entries</em>. Top-level entries are usually entries with no immediate
|
||||
superiors in a hierarchical. For example, the owner of a company, the
|
||||
principle of a school or the root directory of a Unix file
|
||||
system. Toplevel entries are displayed with no indentation.
|
||||
<P>As evident from program 4-2, all entries who
|
||||
entry-path does not contain a separator character are top-level
|
||||
entries. The only exception is the separator character itself is
|
||||
also a toplevel entry. This makes it easy to display Unix file and
|
||||
directory names inside the HList widget, as shown in program
|
||||
4-4.
|
||||
<P>
|
||||
<blockquote> <P><tt> set folder [tix getimage folder]<BR>
|
||||
tixScrolledHList .sh -options {<BR>
|
||||
hlist.separator /<BR>
|
||||
hlist.itemType imagetext<BR>
|
||||
hlist.drawBranch true<BR>
|
||||
hlist.indent 14<BR>
|
||||
hlist.wideSelection false<BR>
|
||||
}<BR>
|
||||
pack .sh -expand yes -fill both<BR>
|
||||
set hlist [.sh subwidget hlist]<BR>
|
||||
<BR>
|
||||
foreach directory {/ /usr /usr/bin /usr/local /etc /etc/rc.d} {<BR>
|
||||
$hlist add $directory -image $folder -text $directory<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 4-4) Displaying Directories in a HList Widget<A NAME=44> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<blockquote> <P><P>
|
||||
<P><CENTER><IMG SRC="../gif/tix/hlist/hlist_ex2.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
Each entry is associated with a display item (see section 3.2
|
||||
about display items). We can use the <tt>-itemtype</tt>
|
||||
option of the HList widget to specify the default type of display item
|
||||
to be created by the the <tt>add</tt> method, as shown in program 4-2
|
||||
and 4-4. Alternatively, we can also specify
|
||||
the type of display item using the <tt>-itemtype</tt> option for the <tt>add</tt> method.
|
||||
<P><HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
26
docs/html/TixBook/subsubsection3_6_1_3.html
Normal file
26
docs/html/TixBook/subsubsection3_6_1_3.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<HEAD>
|
||||
<TITLE> Controlling the Layout of the Entries<A NAME=413> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html939 HREF=subsubsection3_6_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html937 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html931 HREF=subsubsection3_6_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html941 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html940 HREF=subsubsection3_6_1_4.html> Handling the Selection </A>
|
||||
<B>Up:</B> <A NAME=tex2html938 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<B> Previous:</B> <A NAME=tex2html932 HREF=subsubsection3_6_1_2.html> Creating Entries in </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00061300000000000000> Controlling the Layout of the Entries<A NAME=413> </A></A></H3>
|
||||
<P>
|
||||
There are two options to control the layout of the entries: the <tt>-showbranch</tt> option specifies whether branch lines should be drawn
|
||||
between parent entries and their children. The <tt>-indent</tt> option
|
||||
controls the amount of relative indentation between parent and child
|
||||
entries. Notice the <tt>-drawbranch</tt> option is turned on in figure 4-5
|
||||
but turned off in figure 4-3. Usually, you need
|
||||
to set a bigger indentation when the branches are shown - we used an
|
||||
indentation of 14 pixels in 4-5 compared to 8 pixels in 4-3
|
||||
. <P><HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
35
docs/html/TixBook/subsubsection3_6_1_4.html
Normal file
35
docs/html/TixBook/subsubsection3_6_1_4.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<HEAD>
|
||||
<TITLE> Handling the Selection and User Event<A NAME=414> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html948 HREF=subsection3_6_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html946 HREF=subsection3_6_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html942 HREF=subsubsection3_6_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html950 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html949 HREF=subsection3_6_2.html> Creating Collapsible Tree </A>
|
||||
<B>Up:</B> <A NAME=tex2html947 HREF=subsection3_6_1.html> TixHList - The </A>
|
||||
<B> Previous:</B> <A NAME=tex2html943 HREF=subsubsection3_6_1_3.html> Controlling the Layout </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00061400000000000000> Handling the Selection and User Event<A NAME=414> </A></A></H3>
|
||||
<P>
|
||||
The handling of the selection and user events for the HList widget
|
||||
is very similar to the TList widget (see section
|
||||
3.3.5), except that for the HList widget all the
|
||||
operations are based on entry-paths, not list indices. The methods
|
||||
<tt>info selection</tt>, <tt>selection set</tt> and <tt>selection clear</tt>
|
||||
can be used to query, set or clear the selection; the option <tt>-selectmode</tt> controls how many entries can be selected at a time;
|
||||
the options <tt>-browsecmd</tt> and <tt>-command</tt> can be used to
|
||||
specify a command to be called to handle user events.
|
||||
<P>
|
||||
There is one more option worth mentioning: the <tt>-wideselection</tt>
|
||||
option. When set to <tt>true</tt>, the selection highlight will be drawn
|
||||
across the whole HList widget (see figure 4-3). When set to
|
||||
false, selection highlight will be drawn as wide as the selected entry
|
||||
(see figure 4-5). Normally, you would set <tt>-wideselection</tt> to <tt>false</tt> when you use <tt>imagetext</tt> items inside
|
||||
(as we did in program 4-4).
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
43
docs/html/TixBook/subsubsection3_7_1_1.html
Normal file
43
docs/html/TixBook/subsubsection3_7_1_1.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<HEAD>
|
||||
<TITLE> Using the TixFileSelectDialog Widget<A NAME=511> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1002 HREF=subsubsection3_7_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1000 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html994 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1004 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1003 HREF=subsubsection3_7_1_2.html> The Subwidget in </A>
|
||||
<B>Up:</B> <A NAME=tex2html1001 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B> Previous:</B> <A NAME=tex2html995 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00071100000000000000> Using the TixFileSelectDialog Widget<A NAME=511> </A></A></H3>
|
||||
<P>
|
||||
An example of using the TixFileSelectDialog widget is in figure 5-1
|
||||
. At line 1, we create a TixFileSelectDialog widget and set
|
||||
the title of the dialog to ``Select A File'' using the <tt>-title</tt>
|
||||
option. We also use the <tt>-command</tt> option to specify that the
|
||||
procedure <tt>selectCmd</tt> should be called when the user has selected a
|
||||
file. <tt>selectCmd</tt> will be called with one parameter, the filename
|
||||
selected by the user. When the TixFileSelectDialog widget is created, it
|
||||
is initially not shown on the screen. Therefore, at line 3, we call its
|
||||
<tt>popup</tt> widget command to place the widget on the screen.
|
||||
<P>
|
||||
<P><tt> tixFileSelectDialog .file -title "Select A File" -command selectCmd<BR>
|
||||
.file subwidget fsbox config -pattern "*.txt" -directory /usr/info<BR>
|
||||
.file popup<BR>
|
||||
<BR>
|
||||
proc selectCmd {filename} {<BR>
|
||||
puts "You have selected $filename"<BR>
|
||||
}</tt>
|
||||
<P><P><CENTER>(Figure 5-1) Using the TixFileSelectDialog<A NAME=51> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<blockquote> <P><P><CENTER><IMG SRC="../gif/tix/filesel/fb_comp.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
42
docs/html/TixBook/subsubsection3_7_1_2.html
Normal file
42
docs/html/TixBook/subsubsection3_7_1_2.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<HEAD>
|
||||
<TITLE> The Subwidget in the TixFileSelectDialog<A NAME=512> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1013 HREF=subsubsection3_7_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1011 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1005 HREF=subsubsection3_7_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1015 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1014 HREF=subsubsection3_7_1_3.html> The TixExFileSelectDialog Widget</A>
|
||||
<B>Up:</B> <A NAME=tex2html1012 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1006 HREF=subsubsection3_7_1_1.html> Using the TixFileSelectDialog </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00071200000000000000> The Subwidget in the TixFileSelectDialog<A NAME=512> </A></A></H3>
|
||||
<P>
|
||||
We may also want to set other options for the file dialog such as its file
|
||||
filter and working directory. To do this, we must know the composition of
|
||||
the TixFileSelectDialog widget. As shown in figure 5-2, the
|
||||
TixFileSelectDialog contains a subwidget <tt>fsbox</tt> of the type
|
||||
TixFileSelectBox and a subwidget <tt>bbox</tt> of the type TixStdButtonBox.
|
||||
<P>
|
||||
The <tt>fsbox</tt> subwidget supports the <tt>-pattern</tt> and <tt>-directory</tt> options. At line 2 of figure 5-1, we use the <tt>-directory</tt> option to tell the <tt>fsbox</tt> subwidget to display files in
|
||||
the directory <tt>/usr/info</tt>; we also use the <tt>-pattern</tt> option to
|
||||
specify we only want the filenames that has the <tt>txt</tt> extension.
|
||||
<P>
|
||||
The <tt>fsbox</tt> subwidget also supports the <tt>-selection</tt> option,
|
||||
which stores the filename currently selected by the user. We can
|
||||
query this value by the <tt>cget</tt> widget command of the <tt>fsbox</tt>
|
||||
subwidget.
|
||||
<P>
|
||||
Remember that the <tt>-pattern</tt>, <tt>-directory</tt> and <tt>-selection</tt>
|
||||
options do not belong to the TixFileSelectDialog widget. A common mistake
|
||||
that people make is to try to configure the non-existent <tt>-pattern</tt>
|
||||
option of the TixFileSelectDialog, which causes much despair, long error
|
||||
messages and great loss of self-confidence. <em>Always remember:</em>, when
|
||||
you want to configure an option, find out whether it belongs to the
|
||||
widget or its subwidgets.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
35
docs/html/TixBook/subsubsection3_7_1_3.html
Normal file
35
docs/html/TixBook/subsubsection3_7_1_3.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<HEAD>
|
||||
<TITLE> The TixExFileSelectDialog Widget<A NAME=513> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1024 HREF=subsubsection3_7_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1022 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1016 HREF=subsubsection3_7_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1026 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1025 HREF=subsubsection3_7_1_4.html> Specifying File Types </A>
|
||||
<B>Up:</B> <A NAME=tex2html1023 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1017 HREF=subsubsection3_7_1_2.html> The Subwidget in </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00071300000000000000> The TixExFileSelectDialog Widget<A NAME=513> </A></A></H3>
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/filesel/exfile.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
The TixExFileSelectDialog widget is very similar to the TixFileSelectDialog
|
||||
widget. It supports all the options and widget commands of the latter, so
|
||||
essentially we can just take the program 5-1 and replace the
|
||||
command <tt>tixFileSelectDialog</tt> in the first line to <tt>tixExFileSelectDialog</tt>.
|
||||
<P>
|
||||
The composition of the TixExFileSelectDialog widget is a bit different: it
|
||||
contains one contains one subwidget, which is also called <tt>fsbox</tt>, of
|
||||
the type TixExFileSelectBox widget (figure 5-3). Again this
|
||||
<tt>fsbox</tt> widgets supports all widget options and commands of the <tt>fsbox</tt> subwidget in TixFileSelectDialog, so the line 2 of program 5-1
|
||||
can work for TixExFileSelectDialog widgets without any
|
||||
change.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_7_1_4.html
Normal file
31
docs/html/TixBook/subsubsection3_7_1_4.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Specifying File Types for TixExFileSelectDialog<A NAME=514> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1035 HREF=subsubsectionstar3_7_1_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1033 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1027 HREF=subsubsection3_7_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1037 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1036 HREF=subsubsectionstar3_7_1_5.html> 5.1.5 The tix </A>
|
||||
<B>Up:</B> <A NAME=tex2html1034 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1028 HREF=subsubsection3_7_1_3.html> The TixExFileSelectDialog Widget</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00071400000000000000> Specifying File Types for TixExFileSelectDialog<A NAME=514> </A></A></H3>
|
||||
<P>
|
||||
The TixExFileSelectBox widget has a ComboBox subwidget marked as
|
||||
``Select Files of Type:'' (see figure 5-3). This widget
|
||||
contains some pre-set types of files for the user to choose
|
||||
from. For example, a word processor program can include choices such
|
||||
as ``Microsoft Word Documents'' and ``WordPerfect Documents''.
|
||||
<P>
|
||||
The TixExFileSelectBox widget has a <tt>-filetypes</tt> option for this
|
||||
purpose. As shown in line 3 through 7 in program 5-4, the
|
||||
value for the <tt>-filetypes</tt> option is a list. Each item in the list
|
||||
should contain two parts. The first part is a list of file patterns and
|
||||
the second part is the textual name for this type of files.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
43
docs/html/TixBook/subsubsection3_8_1_1.html
Normal file
43
docs/html/TixBook/subsubsection3_8_1_1.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<HEAD>
|
||||
<TITLE> Widget Classes and Widget Instances<A NAME=611> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1112 HREF=subsubsection3_8_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1110 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1104 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1114 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1113 HREF=subsubsection3_8_1_2.html> What is in </A>
|
||||
<B>Up:</B> <A NAME=tex2html1111 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1105 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00081100000000000000> Widget Classes and Widget Instances<A NAME=611> </A></A></H3>
|
||||
<P>
|
||||
All the mega-widget classes in Tix, such as TixComboBox and
|
||||
TixControl, are implemented in the Tix Intrinsics framework. Also,
|
||||
you can write new <em>widget classes</em> with the Tix Intrinsics. In
|
||||
the next section, I'll go through all the steps of creating a new
|
||||
widget class in Tix. I'll illustrate the idea using a new class
|
||||
``TixArrowButton'' as an example. TixArrowButton is essentially a
|
||||
button that can display an arrow in one of the for directions
|
||||
(see figure 6-1).
|
||||
<P>
|
||||
<blockquote> <P><CENTER><IMG SRC="../gif/tix/oop/arrows.gif">
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
Once you have defined your classes, you can create <em>widget
|
||||
instances</em> of these classes. For example, the following code will
|
||||
create four instances of your new TixArrowButton class:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixArrowButton .up -direction n<BR>
|
||||
tixArrowButton .left -direction e<BR>
|
||||
tixArrowButton .right -direction w<BR>
|
||||
tixArrowButton .down -direction s
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
22
docs/html/TixBook/subsubsection3_8_1_2.html
Normal file
22
docs/html/TixBook/subsubsection3_8_1_2.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<HEAD>
|
||||
<TITLE> What is in a Widget Instance<A NAME=612> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1123 HREF=subsubsectionstar3_8_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1121 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1115 HREF=subsubsection3_8_1_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1125 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1124 HREF=subsubsectionstar3_8_1_3.html> Variables</A>
|
||||
<B>Up:</B> <A NAME=tex2html1122 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1116 HREF=subsubsection3_8_1_1.html> Widget Classes and </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00081200000000000000> What is in a Widget Instance<A NAME=612> </A></A></H3>
|
||||
<P>
|
||||
Each widget instance is composed of three integral parts: variables,
|
||||
methods and component widgets
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
91
docs/html/TixBook/subsubsection3_8_2_1.html
Normal file
91
docs/html/TixBook/subsubsection3_8_2_1.html
Normal file
@@ -0,0 +1,91 @@
|
||||
<HEAD>
|
||||
<TITLE> Using the tixWidgetClass Command<A NAME=621> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1175 HREF=subsection3_8_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1173 HREF=subsection3_8_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1169 HREF=subsection3_8_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1177 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1176 HREF=subsection3_8_3.html> Writing Methods</A>
|
||||
<B>Up:</B> <A NAME=tex2html1174 HREF=subsection3_8_2.html> Widget Class Declaration</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1170 HREF=subsection3_8_2.html> Widget Class Declaration</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00082100000000000000> Using the tixWidgetClass Command<A NAME=621> </A></A></H3>
|
||||
<P>
|
||||
We can use the <tt>tixWidgetClass</tt> command to declare a new
|
||||
class. The syntax is:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixWidgetClass classCommandName {<BR>
|
||||
-switch value<BR>
|
||||
-switch value<BR>
|
||||
....<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
For example, the following is the declaration section of TixArrowButton:
|
||||
<P>
|
||||
<P><tt> tixWidgetClass tixArrowButton {<BR>
|
||||
-classname TixArrowButton<BR>
|
||||
-superclass tixPrimitive<BR>
|
||||
-method {<BR>
|
||||
flash invoke invert<BR>
|
||||
}<BR>
|
||||
-flag {<BR>
|
||||
-direction -state<BR>
|
||||
}<BR>
|
||||
-configspec {<BR>
|
||||
{-direction direction Direction e}<BR>
|
||||
{-state state State normal}<BR>
|
||||
}<BR>
|
||||
-alias {<BR>
|
||||
{-dir -direction}<BR>
|
||||
}<BR>
|
||||
-default {<BR>
|
||||
{*Button.anchor c}<BR>
|
||||
{*Button.padX 5}<BR>
|
||||
}<BR>
|
||||
}</tt><P><P><CENTER>(Figure 6-2) declaration of the TixArrowButton Class<A NAME=62> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
We'll look at what each option means as I describe the command in
|
||||
the following sections.
|
||||
<P>
|
||||
The first argument for <tt>tixWidgetClass</tt> is the <em>command name</em>
|
||||
for the widget class (<tt>tixArrowButton</tt>). Command names are used to
|
||||
create widgets of this class. For example, the code
|
||||
<P>
|
||||
<blockquote> <P><tt> tixArrowButton .arrow
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
creates a widget instance <tt>.arrow</tt> of the class
|
||||
TixArrowButton. Also, the command name is used as a prefix of all
|
||||
the methods of this class. For example, the <tt>Foo</tt> and <tt>Bar</tt>
|
||||
methods of the class TixArrowButton will be written as <tt>tixArrowButton:Foo</tt> and <tt>tixArrowButton:Bar</tt>.
|
||||
<P>
|
||||
The <em>class name</em> of the class (<tt>TixArrowButton</tt>)is specified
|
||||
by the <tt>-classname</tt> switch inside the main body of the
|
||||
declaration. The class name is used only to specify options in the
|
||||
TK option database. For example, the following commands specifies
|
||||
the TixArrowButton widget instances should have the default value
|
||||
<tt>up</tt> for their <tt>-direction</tt> option and the default value
|
||||
<tt>normal</tt> for their <tt>-state</tt> option.
|
||||
<P>
|
||||
<blockquote> <P><tt> option add *TixArrowButton.direction up<BR>
|
||||
option add *TixArrowButton.state normal
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>Notice the difference in the capitalization of the class name
|
||||
and the command name of the TixArrowButton class: both of them has
|
||||
the individual words capitalized, but the command name (<tt>tixArrowButton</tt>)starts with a lower case letter while the class name
|
||||
(<tt>TixArrowButton</tt>) starts with an upper case letter. When you
|
||||
create your own classes, you should follow this naming convention.
|
||||
<P>The <tt>-superclass</tt> switch specifies the superclass of the new
|
||||
widget. In our example, we have set it to <tt>tixPrimitive</tt>. Again,
|
||||
pay attention to the capitalization: we should use the command name
|
||||
of the superclass, not its class name.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsection3_8_3_1.html
Normal file
31
docs/html/TixBook/subsubsection3_8_3_1.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Declaring Public Methods<A NAME=631> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1196 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1194 HREF=subsection3_8_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1190 HREF=subsection3_8_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1198 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1197 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B>Up:</B> <A NAME=tex2html1195 HREF=subsection3_8_3.html> Writing Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1191 HREF=subsection3_8_3.html> Writing Methods</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00083100000000000000> Declaring Public Methods<A NAME=631> </A></A></H3>
|
||||
<P>
|
||||
All the methods of a class are by default private methods and cannot
|
||||
be accessed by the application programmer. If you want to make a
|
||||
method public, you can include its name in the <tt>-method</tt> section
|
||||
of the class declaration. In our TixArrowButton example, we have
|
||||
declared that the methods <tt>flash</tt>, <tt>invert</tt> and <tt>invoke</tt>
|
||||
are public methods and they can be accessed by the application
|
||||
programmer. All other methods of the TixArrowButton class will be
|
||||
private.
|
||||
Usually, the names of private methods start with a capital letter
|
||||
with individual words capitalized. The names of public methods
|
||||
start with a lowercase letter.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
34
docs/html/TixBook/subsubsection3_8_4_1.html
Normal file
34
docs/html/TixBook/subsubsection3_8_4_1.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<HEAD>
|
||||
<TITLE> The InitWidgetRec Method<A NAME=641> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1223 HREF=subsubsectionstar3_8_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1221 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1215 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1225 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1224 HREF=subsubsectionstar3_8_4_2.html> Chaining Methods</A>
|
||||
<B>Up:</B> <A NAME=tex2html1222 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1216 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00084100000000000000> The InitWidgetRec Method<A NAME=641> </A></A></H3>
|
||||
<P>
|
||||
The purpose of the <tt>InitWidgetRec</tt> method is to initialize the
|
||||
variables of the widget instance. For example, the following
|
||||
implementation of <tt>tixArrowButton:InitWidgetRec</tt> sets the <tt>count</tt> variable of each newly created instance to zero.
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:InitWidgetRec {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
set data(count) 0<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Earlier, we showed how each widget you create is associated with an
|
||||
array of the same name. Within the methods, you always refer to
|
||||
this array through the name <tt>data</tt> -the method then works
|
||||
properly in each instance of the widget.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
41
docs/html/TixBook/subsubsection3_8_4_4.html
Normal file
41
docs/html/TixBook/subsubsection3_8_4_4.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<HEAD>
|
||||
<TITLE> The ConstructWidget Method<A NAME=642> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1256 HREF=subsubsection3_8_4_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1254 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1248 HREF=subsubsectionstar3_8_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1258 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1257 HREF=subsubsection3_8_4_5.html> The SetBindings Method</A>
|
||||
<B>Up:</B> <A NAME=tex2html1255 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1249 HREF=subsubsectionstar3_8_4_3.html> The tixChainMethod call</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00084400000000000000> The ConstructWidget Method<A NAME=642> </A></A></H3>
|
||||
<P>
|
||||
The <tt>ConstructWidget</tt> method is used to creates the components
|
||||
of a widget instance. In the case of TixArrowButton, we want to
|
||||
create a new button subwidget, whose name is <tt>button</tt>, and use a
|
||||
bitmap to display an arrow on this button. Assuming the bitmap files
|
||||
are stored in the files <tt>up.xbm</tt>, <tt>down.xbm</tt>, <tt>left.xbm</tt>
|
||||
and <tt>right.xbm</tt>, the string substitution <tt>@$data(-direction).xbm</tt> will give us the appropriate bitmap
|
||||
depending on the current direction option of the widget instance.
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:ConstructWidget {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
tixChainMethod $w ConstructWidget<BR>
|
||||
<BR>
|
||||
set data(w:button) [button $w.button -bitmap @$data(-direction).xbm]<BR>
|
||||
pack $data(w:button) -expand yes -fill both<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>The <tt>tixArrowButton:ConstructWidget</tt> method shown above sets
|
||||
the variable <tt>data(w:button)</tt> to be the pathname of the <tt>button</tt> subwidget. As a convention of the Tix Intrinsics, we must
|
||||
declare a public subwidget <em>swid</em> by storing its pathname in the
|
||||
variable <tt>data(w:</tt><em>swid</em><tt>)</tt>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
45
docs/html/TixBook/subsubsection3_8_4_5.html
Normal file
45
docs/html/TixBook/subsubsection3_8_4_5.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<HEAD>
|
||||
<TITLE> The SetBindings Method<A NAME=643> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1265 HREF=subsection3_8_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1263 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1259 HREF=subsubsection3_8_4_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1267 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1266 HREF=subsection3_8_5.html> Declaring and Using </A>
|
||||
<B>Up:</B> <A NAME=tex2html1264 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1260 HREF=subsubsection3_8_4_4.html> The ConstructWidget Method</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00084500000000000000> The SetBindings Method<A NAME=643> </A></A></H3>
|
||||
<P>
|
||||
In your interface, you want to handle a lot of events in the
|
||||
subwidgets that make up your mega-widget. For instance, when
|
||||
somebody presses the button in a TixArrowButton widget, you want the
|
||||
button to handle the event. The <tt>SetBindings</tt> method is used to
|
||||
creates event bindings for the components inside the mega-widget. In
|
||||
our TixArrowButton example, we use the bind command to specify that
|
||||
the method <tt>tixArrowButton:IncrCount</tt> should be called each
|
||||
time when the user presses the first mouse button. As a result, we
|
||||
can count the number of times the user has pressed on the button
|
||||
(obviously for no better reasons than using it as a dumb example).
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:SetBindings {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
tixChainMethod $w SetBindings<BR>
|
||||
<BR>
|
||||
bind $data(w:button) $<$1$>$ "tixArrowButton:IncrCount $w"<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
proc tixArrowButton:IncrCount {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
incr data(count)<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
49
docs/html/TixBook/subsubsection3_8_5_1.html
Normal file
49
docs/html/TixBook/subsubsection3_8_5_1.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<HEAD>
|
||||
<TITLE> Initialization of Public Variables<A NAME=651> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1291 HREF=subsubsectionstar3_8_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1289 HREF=subsection3_8_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1283 HREF=subsection3_8_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1293 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1292 HREF=subsubsectionstar3_8_5_2.html> Type Checker</A>
|
||||
<B>Up:</B> <A NAME=tex2html1290 HREF=subsection3_8_5.html> Declaring and Using </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1284 HREF=subsection3_8_5.html> Declaring and Using </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00085100000000000000> Initialization of Public Variables<A NAME=651> </A></A></H3>
|
||||
<P>
|
||||
When a widget instance is created, all of its public variables are
|
||||
initialized by the Tix Intrinsics before the <tt>InitWidgetRec</tt>
|
||||
method is called. Therefore, <tt>InitWidgetRec</tt> and any other
|
||||
method of this widgte instance are free to assume that all the
|
||||
public variables have been properly initialized and use them as
|
||||
such.
|
||||
<P>The public variables are initialized by the following criteria.
|
||||
<P>
|
||||
<blockquote> <UL><P><LI><P>Step 1: If the value of the variable is specified by the
|
||||
creation command, this value is used. For example, if the
|
||||
application programmer has created an instance in the following way:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixArrowButton .arr -direction n
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>The value <tt>n</tt> will be used for the -direction variable.
|
||||
<P><LI><P>Step 2: if step 1 fails but the value of the variable is
|
||||
specified in the options database, that value is used. For example,
|
||||
if the user has created an instance in the following way:
|
||||
<P>
|
||||
<blockquote> <P><tt> option add *TixArrowButton.direction w<BR>
|
||||
tixArrowButton .arr
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>The value <tt>w</tt> will be used for the <tt>-direction</tt> variable.
|
||||
<P><LI><P>Step3: if step 2 also fails, the default value specified in
|
||||
the <tt>-configspec</tt> secton of the class declaration will be used.
|
||||
<P></UL>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
78
docs/html/TixBook/subsubsection3_8_5_3.html
Normal file
78
docs/html/TixBook/subsubsection3_8_5_3.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<HEAD>
|
||||
<TITLE> Public Variable Configuration Methods<A NAME=652> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1313 HREF=subsubsectionstar3_8_5_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1311 HREF=subsection3_8_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1305 HREF=subsubsectionstar3_8_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1315 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1314 HREF=subsubsectionstar3_8_5_4.html> Configuration Methods and </A>
|
||||
<B>Up:</B> <A NAME=tex2html1312 HREF=subsection3_8_5.html> Declaring and Using </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1306 HREF=subsubsectionstar3_8_5_2.html> Type Checker</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00085300000000000000> Public Variable Configuration Methods<A NAME=652> </A></A></H3>
|
||||
<P>
|
||||
After a widget instance is created, the user can assign new values
|
||||
to the public variables using the configure method. For example, the
|
||||
following code changes the <tt>-direction</tt> variable of the <tt>.arr</tt> instance to <tt>n</tt>.
|
||||
<P>
|
||||
<blockquote> <P><tt> .arr configure -direction n
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>In order for configuration to work, you have to define a
|
||||
configuration method that does what the programmer expects. The
|
||||
configuration method of a public variable is invoked whenever the
|
||||
user calls the configure method to change the value of this
|
||||
variable. The name of a configuration method must be the name of the
|
||||
public variable prefixed by the creation command of the class and
|
||||
<tt>:config</tt>. For example, the name configuration method for the
|
||||
<tt>-direction</tt> variable of the TixArrowButton class is <tt>tixArrowButton:config-direction</tt>. The following code implements
|
||||
this method:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:config-direction {w value} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
$data(w:button) config -bitmap @$value.xbm<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Notice that when <tt>tixArrowButton:config-direction</tt> is called,
|
||||
the <tt>value</tt> parameter contains the new value of the <tt>-direction</tt> variable but <tt>data(-direction)</tt> contains the <tt>old</tt> value. This is useful when the configuration method needs to
|
||||
check the previous value of the variable before taking in the new
|
||||
value.
|
||||
<P>If a type checker is defined for a variable, it will be called
|
||||
before the configuration method is called. Therefore, the
|
||||
configuration method can assume that the type of the <tt>value</tt>
|
||||
parameter is got is always correct.
|
||||
<P>Sometimes it is necessary to override the value supplied by the
|
||||
user. The following code illustrates this idea:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:config-direction {w value} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
if {$value == "n"} {<BR>
|
||||
set value s<BR>
|
||||
set data(-direction) $value<BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
$data(w:button) config -bitmap @$value.xbm<BR>
|
||||
return $data(-direction)<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Notice the above code always overrides values of <tt>n</tt> to <tt>s</tt>. If you need to override the value, you must do the following two
|
||||
things:
|
||||
<P>
|
||||
<blockquote> <UL><P><LI><P>Explicitly set the instance variable inside the configuration
|
||||
method (the <tt>set data(-direction) $value</tt> line).
|
||||
<P><LI><P>Return the modified value from the configuration method.
|
||||
</UL>
|
||||
</blockquote>
|
||||
<P>If you do not need to override the value, you don't need to return
|
||||
anything from the configuration method. In this case, the Tix
|
||||
Intrinsics will assign the new value to the instance variable for
|
||||
you.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
41
docs/html/TixBook/subsubsectionstar3_3_2_3.html
Normal file
41
docs/html/TixBook/subsubsectionstar3_3_2_3.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<HEAD>
|
||||
<TITLE> Disabling Callbacks Temporarily<A NAME=1221> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html310 HREF=subsubsection3_3_2_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html308 HREF=subsection3_3_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html302 HREF=subsubsection3_3_2_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html312 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html311 HREF=subsubsection3_3_2_4.html> Validating User Inputs</A>
|
||||
<B>Up:</B> <A NAME=tex2html309 HREF=subsection3_3_2.html> Getting Started: the </A>
|
||||
<B> Previous:</B> <A NAME=tex2html303 HREF=subsubsection3_3_2_2.html> Accessing The Value </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00032300000000000000> Disabling Callbacks Temporarily<A NAME=1221> </A></A></H3>
|
||||
<P>
|
||||
Now, if you want to change a value from within the program, you have to
|
||||
disable the callback. The reason is that the callback runs whenever you
|
||||
(as well as the user) makes a change. In particular, if you make a change
|
||||
within the callback procedure and forget to disable the callback, it will
|
||||
recursively call itself and enter an infinite loop. To avoid this
|
||||
problem, you should use the <tt>-disablecallback</tt> option. Here is an
|
||||
example:
|
||||
<P>
|
||||
<tt> tixControl .c -command addOne<BR>
|
||||
<BR>
|
||||
proc addOne {value} {<BR>
|
||||
.c config -disablecallback true<BR>
|
||||
.c config -value [incr value]<BR>
|
||||
.c config -disablecallback false<BR>
|
||||
}</tt>
|
||||
<P>
|
||||
The procedure <tt>addOne</tt> adjusts the value of <tt>.c</tt> by one whenever
|
||||
the user enters a new value into <tt>.c</tt>. Notice that it is necessary to
|
||||
set <tt>-disablecallback</tt> here or otherwise <tt>addOne</tt> will be
|
||||
infinitely recursed! That is because <tt>addOne</tt> is called <em>every
|
||||
time</em> the value changes, either by the user or by the program.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
27
docs/html/TixBook/subsubsectionstar3_3_5_2.html
Normal file
27
docs/html/TixBook/subsubsectionstar3_3_5_2.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<HEAD>
|
||||
<TITLE> Label and Orientation<A NAME=1511> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html507 HREF=subsubsectionstar3_3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html505 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html499 HREF=subsubsection3_3_5_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html509 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html508 HREF=subsubsectionstar3_3_5_3.html> Creating the Button </A>
|
||||
<B>Up:</B> <A NAME=tex2html506 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html500 HREF=subsubsection3_3_5_1.html> Creating A TixSelect </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035200000000000000> Label and Orientation<A NAME=1511> </A></A></H3>
|
||||
<P>
|
||||
As shown in program 1-11, with the <tt>-label</tt>
|
||||
option, we can put a label next to the button subwidgets as the
|
||||
caption of the TixSelect widget. We can also control the layout of
|
||||
the button subwidgets using the <tt>-orientation</tt> option. The <tt>-orientation</tt> option can have two values: <tt>horizontal</tt> (the
|
||||
default value) or <tt>vertical</tt>, and the buttons are lied up
|
||||
accordingly. Figure 1-12 shows the output of a
|
||||
TixSelect widget whose <tt>-orientation</tt> is set to <tt>vertical</tt>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
45
docs/html/TixBook/subsubsectionstar3_3_5_3.html
Normal file
45
docs/html/TixBook/subsubsectionstar3_3_5_3.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<HEAD>
|
||||
<TITLE> Creating the Button Subwidgets and Configuring
|
||||
Their Appearance<A NAME=1512> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html518 HREF=subsubsectionstar3_3_5_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html516 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html510 HREF=subsubsectionstar3_3_5_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html520 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html519 HREF=subsubsectionstar3_3_5_4.html> Accessing the Button </A>
|
||||
<B>Up:</B> <A NAME=tex2html517 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html511 HREF=subsubsectionstar3_3_5_2.html> Label and Orientation</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035300000000000000> Creating the Button Subwidgets and Configuring
|
||||
Their Appearance<A NAME=1512> </A></A></H3>
|
||||
<P>
|
||||
After we have created the TixSelect widget, we can create the button
|
||||
subwidgets inside the TixSelect widget by the <tt>add</tt> widget
|
||||
command (lines 2-4 of program 1-11).
|
||||
<P>
|
||||
The first argument to the <tt>add</tt> command is the name of the button
|
||||
subwidget. Additional arguments can be given in <em>option-value</em> pairs
|
||||
to configure the appearance of the button subwidget. These <em>option-value</em> pairs can be any of those accepted by a normal TK button
|
||||
widget. As shown in program 1-11, we use the <tt>-text</tt>
|
||||
option to put appropriate text strings over the three button subwidgets.
|
||||
<P>
|
||||
Notice that we also set the <tt>-width</tt> option of all the button
|
||||
subwidgets to 6 characters. This way, the three buttons will have
|
||||
the same width. If we didn't set the <tt>-width</tt> option for the
|
||||
button widgets, they will have different widths, depending on their
|
||||
text string, and the result would look less esthetically pleasing
|
||||
than buttons with same widths.
|
||||
<P>
|
||||
The output of program 1-11 is shown in figure
|
||||
1-12
|
||||
<P>
|
||||
<blockquote> <P><CENTER><P><IMG ALIGN="LEFT" SRC="../gif/tix/intro/select1.gif"> <IMG ALIGN="LEFT" SRC="../gif/tix/intro/select-vert.gif"><BR CLEAR=LEFT><CENTER>(Figure 1-12) The TixSelect Widget<A NAME=112> </A></CENTER><P>
|
||||
</CENTER>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
47
docs/html/TixBook/subsubsectionstar3_3_5_4.html
Normal file
47
docs/html/TixBook/subsubsectionstar3_3_5_4.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<HEAD>
|
||||
<TITLE> Accessing the Button Subwidgets<A NAME=1513> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html529 HREF=subsubsection3_3_5_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html527 HREF=subsection3_3_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html521 HREF=subsubsectionstar3_3_5_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html531 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html530 HREF=subsubsection3_3_5_5.html> Specifying Selection Rules</A>
|
||||
<B>Up:</B> <A NAME=tex2html528 HREF=subsection3_3_5.html> The TixSelect Widget</A>
|
||||
<B> Previous:</B> <A NAME=tex2html522 HREF=subsubsectionstar3_3_5_3.html> Creating the Button </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00035400000000000000> Accessing the Button Subwidgets<A NAME=1513> </A></A></H3>
|
||||
<P>
|
||||
We have already seen the concept of subwidgets and how they can be
|
||||
accessed in section 1.3.1 - when we create a Tix
|
||||
mega-widget, some subwidgets are created for us automatically. For
|
||||
example, the label and entry subwidgets inside a TixControl widget.
|
||||
We can access these subwidgets in a multitude of ways, including
|
||||
using the subwidget method.
|
||||
<P>
|
||||
One thing about the subwidgets we saw in section 1.3.1 is
|
||||
that they are ``static'', meaning they are created when the mega-widget is
|
||||
created and they remain there for the whole lifetime of the mega-widget.
|
||||
<P>
|
||||
The TixSelect widget takes us to a new concept: <em>dynamic
|
||||
subwidgets</em> are subwidgets that can be created on-the-fly. After we
|
||||
add a new button into the TixSelect widget, we get a new
|
||||
subwidget. The name of this new subwidget is given by the first
|
||||
parameter passed to the <tt>add</tt> method. As the following code
|
||||
demonstrates, we can access this new subwidget using the <tt>subwidget</tt> method:
|
||||
<P>
|
||||
<blockquote> <tt> tixSelect .s<BR>
|
||||
.s add apple -text Apple<BR>
|
||||
.s add orange -text Orange<BR>
|
||||
# Mmmm..., let's make the widget look more educated<BR>
|
||||
# by using French words<BR>
|
||||
.s subwidget apple config -text Pomme<BR>
|
||||
.s subwidget orange config -text Orange
|
||||
</tt>
|
||||
</blockquote>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
77
docs/html/TixBook/subsubsectionstar3_7_1_5.html
Normal file
77
docs/html/TixBook/subsubsectionstar3_7_1_5.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<HEAD>
|
||||
<TITLE> 5.1.5 The <b><tt>tix filedialog</tt></b> Command<A NAME=515> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1044 HREF=subsection3_7_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1042 HREF=subsection3_7_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1038 HREF=subsubsection3_7_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1046 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1045 HREF=subsection3_7_2.html> Selecting Directories with </A>
|
||||
<B>Up:</B> <A NAME=tex2html1043 HREF=subsection3_7_1.html> File Selection Dialog </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1039 HREF=subsubsection3_7_1_4.html> Specifying File Types </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00071500000000000000> 5.1.5 The <b><tt>tix filedialog</tt></b> Command<A NAME=515> </A></A></H3>
|
||||
<P>
|
||||
TixExFileSelectDialog and TixFileSelectDialog are very similar to
|
||||
each other. So which one should we use? That is just a matter of
|
||||
taste. However, since we know that programmers usually have bad
|
||||
taste, clever programmers would rather step aside and let the users
|
||||
exercise their own taste. To do this, we can use the <tt>tix
|
||||
filedialog</tt> command.
|
||||
<P>
|
||||
For any programs based on Tix, the user can choose his preferred
|
||||
type of file dialog by setting the X resource <tt>FileDialog</tt> to
|
||||
either <tt>tixFileSelectDialog</tt> or <tt>tixExFileSelectDialog</tt>.
|
||||
This can usually be done by inserting a line similar to the
|
||||
following into the user's <tt>.Xdefaults</tt> file:
|
||||
<blockquote> <P><tt> *myapp*FileDialog: tixExFileSelectDialog
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
When we call the command <tt>tix filedialog</tt>, it will return a file
|
||||
dialog widget of the user's preferred type.
|
||||
<P>
|
||||
The advantage of using <tt>tix filedialog</tt> is it makes coding
|
||||
flexible. If the management suddenly mandates that we dump the Motif
|
||||
look-and-feel in favor of the MS Windows look-and-feel, we don't need to
|
||||
dig up every line of <tt>tixFileSelectDialog</tt> calls and replace it with
|
||||
<tt>tixExFileSelectDialog</tt>. Also, <tt>tix filedialog</tt> creates only one
|
||||
copy of the file dialog, which can be shared by different parts of the
|
||||
program. Therefore, we can avoid creating a separate file dialog widget
|
||||
for each of the ``Open'', ``Save'' and ``Save As'' commands in our
|
||||
application. This way, we can save resource since a file dialog is a
|
||||
large widget and it takes up quite a bit of space.
|
||||
<P>
|
||||
<blockquote> <P><tt> set dialog [tix filedialog]<BR>
|
||||
$dialog -title "Select A File" -command selectCmd<BR>
|
||||
$dialog subwidget fsbox config -pattern "*.txt" -directory /usr/info<BR>
|
||||
if {[winfo class $dialog] == "TixExFileSelectDialog"} {<BR>
|
||||
$dialog subwidget fsbox config -filetypes {<BR>
|
||||
{\*} {* - All files}\<BR>
|
||||
{\*.txt} {*.txt - Text files}\<BR>
|
||||
{\*.c} {*.c - C source files}\<BR>
|
||||
}<BR>
|
||||
}<BR>
|
||||
$dialog popup<BR>
|
||||
<BR>
|
||||
proc selectCmd {filename} {<BR>
|
||||
puts "You have selected $filename"<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P><CENTER>(Figure 5-4) Using the <tt>tix dialog</tt> command<A NAME=54> </A>
|
||||
</CENTER>
|
||||
<P>
|
||||
The use of the <tt>tix filedialog</tt> command is shown in program 5-4
|
||||
. This program is very similar to what we saw in program 5-1
|
||||
, except now we aren't really sure which type of file dialog
|
||||
the user have chosen. Therefore, if we want to do something allowed for
|
||||
only one type of file dialogs, we have to be careful. At line 4 of
|
||||
program 5-4, we use the <tt>winfo</tt> command to see whether
|
||||
the type of the file dialog is TixExFileSelectDialog. If so, we set the
|
||||
value for the <tt>-filetypes</tt> option of its <tt>fsbox</tt> subwidget.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
44
docs/html/TixBook/subsubsectionstar3_8_1_3.html
Normal file
44
docs/html/TixBook/subsubsectionstar3_8_1_3.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<HEAD>
|
||||
<TITLE> Variables<A NAME=6121> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1134 HREF=subsubsectionstar3_8_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1132 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1126 HREF=subsubsection3_8_1_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1136 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1135 HREF=subsubsectionstar3_8_1_4.html> Methods</A>
|
||||
<B>Up:</B> <A NAME=tex2html1133 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1127 HREF=subsubsection3_8_1_2.html> What is in </A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00081300000000000000> Variables<A NAME=6121> </A></A></H3>
|
||||
<P>
|
||||
Each widget instance is associated with a set of variables. In the
|
||||
example of an instance of the TixArrowButton class, we may use a
|
||||
variable to store the direction to which the arrow is pointing
|
||||
to. We may also use a variable to count how many times the user has
|
||||
pressed the button.
|
||||
<P>
|
||||
Each variable can be public or private. Public variables may be
|
||||
accessed by the application programmer (usually via <tt>configure</tt>
|
||||
or cget <tt>methods</tt>) and their names usually start with a dash
|
||||
(<tt>-</tt>). They usually are used to represent some user-configurable
|
||||
options of the widget instance. Private variables, on the other
|
||||
hand, cannot be accessed by the application programmer. They are
|
||||
usually used to store information about the widget instance that are
|
||||
of interests only to the widget writer.
|
||||
<P>
|
||||
All the variables of an instance are stored in a global array that
|
||||
has the same name as the instance. For example, the variables of the
|
||||
instance <tt>.up</tt> are stored in the global array <tt>.up:</tt>. The
|
||||
public variable <tt>-direction</tt>, which records the direction to
|
||||
which the arrow is pointing to, is stored in <tt>.up(-direction)</tt>.
|
||||
The private variable <tt>count</tt>, which counts how many times the
|
||||
user has pressed the button, is stored in <tt>.up(count)</tt>. In
|
||||
comparison, the same variables of the <tt>.down</tt> instance are
|
||||
stored in <tt>.down(-direction)</tt> and <tt>.down(count)</tt>.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
34
docs/html/TixBook/subsubsectionstar3_8_1_4.html
Normal file
34
docs/html/TixBook/subsubsectionstar3_8_1_4.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<HEAD>
|
||||
<TITLE> Methods<A NAME=6122> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1145 HREF=subsubsectionstar3_8_1_5.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1143 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1137 HREF=subsubsectionstar3_8_1_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1147 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1146 HREF=subsubsectionstar3_8_1_5.html> Component Widgets</A>
|
||||
<B>Up:</B> <A NAME=tex2html1144 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1138 HREF=subsubsectionstar3_8_1_3.html> Variables</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00081400000000000000> Methods<A NAME=6122> </A></A></H3>
|
||||
<P>
|
||||
To carry out operations on the widget, you define a set of
|
||||
procedures called <em>methods</em> (to use common object-oriented
|
||||
terminology). Each method can be declared as public or private. <em>Public methods</em> can be called by the application programmer. For
|
||||
example, if the TixArrowButton class supports the public methods
|
||||
<tt>invoke</tt> and <tt>invert</tt>, the application programmer can issue
|
||||
the commands to call these method for the widget instance <tt>.up</tt>.
|
||||
<P>
|
||||
<blockquote> <P><tt> .up invert<BR>
|
||||
.up invoke
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>
|
||||
In contrast, <em>Private methods</em> are of interests only to widget
|
||||
writers and cannot be called by application programmers.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
31
docs/html/TixBook/subsubsectionstar3_8_1_5.html
Normal file
31
docs/html/TixBook/subsubsectionstar3_8_1_5.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<HEAD>
|
||||
<TITLE> Component Widgets<A NAME=6123> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1154 HREF=subsection3_8_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1152 HREF=subsection3_8_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1148 HREF=subsubsectionstar3_8_1_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1156 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1155 HREF=subsection3_8_2.html> Widget Class Declaration</A>
|
||||
<B>Up:</B> <A NAME=tex2html1153 HREF=subsection3_8_1.html> Introduction to Tix </A>
|
||||
<B> Previous:</B> <A NAME=tex2html1149 HREF=subsubsectionstar3_8_1_4.html> Methods</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00081500000000000000> Component Widgets<A NAME=6123> </A></A></H3>
|
||||
<P>
|
||||
A Tix mega-widget is composed of one or more component
|
||||
widgets. The main part of a mega-widget is called the <em>root
|
||||
widget</em>, which is usually a frame widget that encompasses all other
|
||||
component widgets. The other component widgets are called <em>subwidgets</em>.
|
||||
<P>The root widget has the same name as the the mega-widget itself. In
|
||||
the above example, we have a mega-widget called <tt>.up</tt>. It has a
|
||||
root widget which is a frame widget and is also called <tt>.up</tt>. Inside <tt>.up</tt> we have a button subwidget called <tt>.up.button</tt>.
|
||||
<P>Similar to variables and methods, component widgets are also
|
||||
classified into public and private component widgets. Only public
|
||||
widgets may be accessed by the application programmer, via the <tt>subwidget</tt> method (see section 1.3.1) of each widget
|
||||
instance.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
44
docs/html/TixBook/subsubsectionstar3_8_4_2.html
Normal file
44
docs/html/TixBook/subsubsectionstar3_8_4_2.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<HEAD>
|
||||
<TITLE> Chaining Methods<A NAME=6411> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1234 HREF=subsubsectionstar3_8_4_3.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1232 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1226 HREF=subsubsection3_8_4_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1236 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1235 HREF=subsubsectionstar3_8_4_3.html> The tixChainMethod call</A>
|
||||
<B>Up:</B> <A NAME=tex2html1233 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1227 HREF=subsubsection3_8_4_1.html> The InitWidgetRec Method</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00084200000000000000> Chaining Methods<A NAME=6411> </A></A></H3>
|
||||
<P>
|
||||
The above implementation is not sufficient because our
|
||||
TixArrowButton class is derived from TixPrimitive. The class
|
||||
derivation in Tix is basically an <em>is-a</em> relationship:
|
||||
TixArrowButton <em>is a</em> TixPrimitive. TixPrimitive defines the
|
||||
method <tt>tixPrimitive:InitWidgetRec</tt> which sets up the instance
|
||||
variables of every instance of TixPrimitive. Since an instance of
|
||||
TixArrowButton is also an instance of TixPrimitive, we need to make
|
||||
sure that the instance variables defined by TixPrimitive are also
|
||||
properly initialized. The technique of calling a method defined in a
|
||||
superclass is called the <em>chaining</em> of a method. The following
|
||||
implementation does this correctly:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:InitWidgetRec {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
tixPrimitive:InitWidgetRec $w<BR>
|
||||
set data(count) 0<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Notice that <tt>tixPrimitive:InitWidgetRec</tt> is called before anything
|
||||
else is done. This way, we can define new classes by means of
|
||||
successive refinement: we can first ask the superclass to set up the
|
||||
instance variables, then we can modify some of those variables when
|
||||
necessary and also define new variables.
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
80
docs/html/TixBook/subsubsectionstar3_8_4_3.html
Normal file
80
docs/html/TixBook/subsubsectionstar3_8_4_3.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<HEAD>
|
||||
<TITLE> The tixChainMethod call<A NAME=6412> </A></TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#000080">
|
||||
<FONT FACE="Tahoma, Arial, Helvetica">
|
||||
<HR> <A NAME=tex2html1245 HREF=subsubsection3_8_4_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/next_motif.gif"></A> <A NAME=tex2html1243 HREF=subsection3_8_4.html><IMG ALIGN=MIDDLE SRC="../gif/icons/up_motif.gif"></A> <A NAME=tex2html1237 HREF=subsubsectionstar3_8_4_2.html><IMG ALIGN=MIDDLE SRC="../gif/icons/previous_motif.gif"></A> <A NAME=tex2html1247 HREF=tableofcontents3_1.html><IMG ALIGN=MIDDLE SRC="../gif/icons/contents_motif.gif"></A> <BR>
|
||||
<B> Next:</B> <A NAME=tex2html1246 HREF=subsubsection3_8_4_4.html> The ConstructWidget Method</A>
|
||||
<B>Up:</B> <A NAME=tex2html1244 HREF=subsection3_8_4.html> Standard Initialization Methods</A>
|
||||
<B> Previous:</B> <A NAME=tex2html1238 HREF=subsubsectionstar3_8_4_2.html> Chaining Methods</A>
|
||||
<HR> <P>
|
||||
<A NAME=Contents> </A><H3><A NAME=SECTION00084300000000000000> The tixChainMethod call<A NAME=6412> </A></A></H3>
|
||||
<P>
|
||||
The above implementation of <tt>tixArrowButton:InitWidgetRec</tt> is
|
||||
correct but it may be cumbersome if we want to switch
|
||||
superclasses. For example, suppose we want to create a new base class
|
||||
TixArrowWidget, which presumably defines common attributes of any
|
||||
class that have arrows in them. Then, instead of deriving
|
||||
TixArrowButton directly from TixPrimitive, we decide to derive
|
||||
TixArrowButton from TixArrowWidget, which is in turn derived from
|
||||
TixPrimitive:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixWidgetClass tixArrowWidget {<BR>
|
||||
-superclass tixPrimitive<BR>
|
||||
...<BR>
|
||||
}<BR>
|
||||
tixWidgetClass tixArrowButton {<BR>
|
||||
-superclass tixArrowWidget<BR>
|
||||
...<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Now we would need to change all the method chaining calls in
|
||||
TixArrowButton from:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixPrimitive:SomeMethod
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>to:
|
||||
<P>
|
||||
<blockquote> <P><tt> tixArrowWidget:SomeMethod
|
||||
</tt>
|
||||
<P></blockquote>
|
||||
<P>This may be a lot of work because you may have chained methods in many
|
||||
places in the original implementation of TixArrowButton.
|
||||
<P>The <tt>tixChainMethod</tt> command solves this problem. It will
|
||||
automatically find a superclass that defines the method we want to
|
||||
chain and calls this method for us. For example, the following is a
|
||||
better implementation of <tt>tixArrowButton:InitWidgetRec</tt> that
|
||||
uses <tt>tixChainMethod</tt> to avoid calling <tt>tixPrimitive:InitWidgetRec</tt> directly:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixArrowButton:InitWidgetRec {w} {<BR>
|
||||
upvar #0 $w data<BR>
|
||||
<BR>
|
||||
tixChainMethod $w InitWidgetRec<BR>
|
||||
set data(count) 0<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>Notice the order of the arguments for tixChainMethod: the name of
|
||||
the instance, <tt>$w</tt>, is passed before the method we want to
|
||||
chain, <tt>InitWidgetRec</tt>. In general, if the method we want to
|
||||
chain has $1+n$arguments:
|
||||
<P>
|
||||
<blockquote> <P><tt> proc tixPrimitive:MethodToChain {w arg1 arg2 ... argn} {<BR>
|
||||
...<BR>
|
||||
}</tt>
|
||||
<P></blockquote>
|
||||
<P>We call it with the arguments in the following order
|
||||
<P>
|
||||
<blockquote> <P><tt> tixChainMethod $w MethodToChain $arg1 $arg2 ... $argn</tt>
|
||||
<P></blockquote>
|
||||
<P>We'll come back to more detailed discussion of <tt>tixChainMethod</tt>
|
||||
shortly. For the time being, let's take it for granted that <tt>tixChainMethod</tt> must be used in the three standard initialization
|
||||
methods: <tt>InitWidgetRec</tt>, <tt>ConstructWidget</tt> and <tt>SetBindings</tt>
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
</FONT>
|
||||
</BODY>
|
||||
<P><ADDRESS>
|
||||
<A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A><BR>
|
||||
</ADDRESS>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user