Debian Codegraph @

html/container.html

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!-- manual page source format generated by PolyglotMan v3.0.8+XFree86, -->
2 <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
3
4 <HTML>
5 <HEAD>
6 <TITLE>container(n) manual page</TITLE>
7 </HEAD>
8 <BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
9 <A HREF="#toc">Table of Contents</A><P>
10
11 <H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
12 container - Widget to contain a foreign window.
13
14 <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
15 <B>container</B> <I>pathName </I>?<I>options</I>?
16 <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
17 The <B>container</B> widget lets
18 you swallow another X11/Win32 toplevel or
19 embed an X11 window from a foreign application into your Tk application.
20 The foreign window is reparented inside of the widget. You can then place
21 and arrange the container just as you would any Tk widget.
22 <H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
23 Notebooks
24 are a popular graphical paradigm. They allow you to organize many windows
25 in a single widget. For example, you might have an application the displays
26 several X-Y graphs at the same time. Typically, you can't pack the graphs
27 into the same <B>frame</B> because they are too large. The other alternative is
28 to pack the graphs into several <B>toplevel</B> widgets, allowing them to overlap
29 on the screen. The problem is that all the different toplevel windows clutter
30 the screen and are difficult to manage. <P>
31 The <B>container</B> widget lets organize
32 your application by displaying each graph as a page in a folder of a notebook.
33 Only one page is visible at a time. When you click on a tab, the folder
34 (graph) corresponding to the tab is displayed in the <B>container</B> widget.
35 The container also lets you temporarily tear pages out of the notebook
36 into a separate toplevel widget, and put them back in the container later.
37 For example, you could compare two graphs side-by-side by tearing them out,
38 and then replace them when you are finished. <P>
39 A container may contain an
40 unlimited number of folders. If there are too many tabs to view, you can
41 arrange them as multiple tiers or scroll the tabs. The container uses the
42 conventional Tk scrollbar syntax, so you can attach a scrollbar too.
43 <H2><A NAME="sect4" HREF="#toc4">Example</A></H2>
44 You
45 create a container widget with the <B>container</B> command. <BR>
46 <CODE># Create a new container<BR>
47 container .c<BR>
48 </CODE><P>A new Tcl command <I>.c</I> is also created. This command can be used to query
49 and modify the container. For example, to change the default borderwidth,
50 you use the new command and the container's <B>configure</B> operation. <BR>
51 <CODE># Change the default font.<BR>
52 .c configure -borderwidth 2<BR>
53 </CODE><P>You can then add folders using the <B>insert</B> operation. <BR>
54 <CODE># Create a new folder "f1"<BR>
55 .c coinsert 0 "f1"<BR>
56 </CODE><P>This inserts the new tab named "f1" into the container. The index <I>0</I> indicates
57 location to insert the new tab. You can also use the index <I>end</I> to append
58 a tab to the end of the container. By default, the text of the tab is the
59 name of the tab. You can change this by configuring the <B>-text</B> option. <BR>
60 <CODE># Change the label of "f1"<BR>
61 .ts tab configure "f1" -label "Tab #1" <BR>
62 </CODE><P>The <B>insert</B> operation lets you add one or more folders at a time. <BR>
63 <CODE>.ts insert end "f2" -label "Tab #2" "f3" "f4" <BR>
64 </CODE><P>The tab on each folder contains a label. A label may display both an image
65 and a text string. You can reconfigure the tab's attributes (foreground/background
66 colors, font, rotation, etc) using the <B>tab configure</B> operation. <BR>
67 <CODE># Add an image to the label of "f1"<BR>
68 set image [image create photo -file stopsign.gif]<BR>
69 .ts tab configure "f1" -image $image<BR>
70 .ts tab configure "f2" -rotate 90<BR>
71 </CODE><P>Each folder may contain an embedded widget to represent its contents. The
72 widget to be embedded must be a child of the container widget. Using the
73 <B>-window</B> option, you specify the name of widget to be embedded. But don't
74 pack the widget, the container takes care of placing and arranging the
75 widget for you. <BR>
76 <CODE>graph .ts.graph<BR>
77 .ts tab configure "f1" -window ".ts.graph" \<BR>
78 -fill both -padx 0.25i -pady 0.25i<BR>
79 </CODE><P>The size of the folder is determined the sizes of the Tk widgets embedded
80 inside each folder. The folder will be as wide as the widest widget in
81 any folder. The tallest determines the height. You can use the tab's <B>-pagewidth</B>
82 and <B>-pageheight</B> options override this. <P>
83 Other options control how the widget
84 appears in the folder. The <B>-fill</B> option says that you wish to have the widget
85 stretch to fill the available space in the folder. <BR>
86 <CODE>.ts tab configure "f1" -fill both -padx 0.25i -pady 0.25i<BR>
87 <P>
88 </CODE><P>Now when you click the left mouse button on "f1", the graph will be displayed
89 in the folder. It will be automatically hidden when another folder is selected.
90 If you click on the right mouse button, the embedded widget will be moved
91 into a toplevel widget of its own. Clicking again on the right mouse button
92 puts it back into the folder. <P>
93 If you want to share a page between two different
94 folders, the <B>-command</B> option lets you specify a Tcl command to be invoked
95 whenever the folder is selected. You can reset the <B>-window</B> option for the
96 tab whenever it's clicked. <BR>
97 <CODE>.ts tab configure "f2" -command { <BR>
98 .ts tab configure "f2" -window ".ts.graph"<BR>
99 }<BR>
100 .ts tab configure "f1" -command { <BR>
101 .ts tab configure "f1" -window ".ts.graph"<BR>
102 }<BR>
103 </CODE><P>If you have many folders, you may wish to stack tabs in multiple tiers.
104 The container's <B>-tiers</B> option requests a maximum number of tiers. The default
105 is one tier. <BR>
106 <CODE>.ts configure -tiers 2<BR>
107 </CODE><P>If the tabs can fit in less tiers, the widget will use that many. Whenever
108 there are more tabs than can be displayed in the maximum number of tiers,
109 the container will automatically let you scroll the tabs. You can even
110 attach a scrollbar to the container. <BR>
111 <CODE>.ts configure -scrollcommand { .sbar set } -scrollincrement 20<BR>
112 .sbar configure -orient horizontal -command { .ts view }<BR>
113 </CODE><P>By default tabs are along the top of the container from left to right.
114 But tabs can be placed on any side of the container using the <B>-side</B> option.
115 <BR>
116 <CODE># Arrange tabs along the right side of the container. <BR>
117 .ts configure -side right -rotate 270<BR>
118
119 <H2><A NAME="sect5" HREF="#toc5"></CODE><P>Syntax</A></H2>
120 The <B>container</B> command creates a new window using the <I>pathName</I> argument
121 and makes it into a container widget. <BR>
122 <CODE><B>container <I>pathName </I></B>?<I>option value</I>?...<BR>
123 </CODE><P>Additional options may be specified on the command line or in the option
124 database to configure aspects of the container such as its colors, font,
125 text, and relief. The <B>container</B> command returns its <I>pathName</I> argument.
126 At the time this command is invoked, there must not exist a window named
127 <I>pathName</I>, but <I>pathName</I>'s parent must exist. <P>
128 When first created, a new container
129 contains no tabs. Tabs are added or deleted using widget operations described
130 below. It is not necessary for all the tabs to be displayed in the container
131 window at once; commands described below may be used to change the view
132 in the window. Containers allow scrolling of tabs using the <B>-scrollcommand</B>
133 option. They also support scanning (see the <B>scan</B> operation). Tabs may be
134 arranged along any side of the container window using the <B>-side</B> option. <P>
135 The
136 size of the container window is determined the number of tiers of tabs
137 and the sizes of the Tk widgets embedded inside each folder. The widest
138 widget determines the width of the folder. The tallest determines the height.
139 If no folders contain an embedded widget, the size is detemined solely
140 by the size of the tabs. <P>
141 You can override either dimension with the container's
142 <B>-width</B> and <B>-height</B> options.
143 <H2><A NAME="sect6" HREF="#toc6">Container Operations</A></H2>
144 All <B>container</B> operations are
145 invoked by specifying the widget's pathname, the operation, and any arguments
146 that pertain to that operation. The general form is: <P>
147 <BR>
148 <CODE><tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;<I>pathName operation </I>?<I>arg arg ...</I>?<BR>
149 <P>
150 </CODE><P><I>Operation</I> and the <I>arg</I>s determine the exact behavior of the command. The
151 following operations are available for container widgets:
152 <DL>
153
154 <DT><I>pathName <B>cget</B></I>
155 <I>option</I> </DT>
156 <DD>Returns the current value of the configuration option given by <I>option</I>.
157 <I>Option</I> may have any of the values accepted by the <B>configure</B> operation described
158 below. </DD>
159
160 <DT><I>pathName <B>configure</B></I> ?<I>option</I>? ?<I>value option value ...</I>? </DT>
161 <DD>Query or modify
162 the configuration options of the widget. If no <I>option</I> is specified, returns
163 a list describing all the available options for <I>pathName</I> (see <B>Tk_ConfigureInfo</B>
164 for information on the format of this list). If <I>option</I> is specified with
165 no <I>value</I>, then the command returns a list describing the one named option
166 (this list will be identical to the corresponding sublist of the value
167 returned if no <I>option</I> is specified). If one or more <I>option-value</I> pairs are
168 specified, then the command modifies the given widget option(s) to have
169 the given value(s); in this case the command returns an empty string. <I>Option</I>
170 and <I>value</I> are described below: <blockquote></DD>
171
172 <DT><B>-background <I>color</I></B> </DT>
173 <DD>Sets the border color of
174 the container. </DD>
175
176 <DT><B>-borderwidth <I>pixels</I></B> </DT>
177 <DD>Sets the width of the 3-D border around
178 the outside edge of the widget. The <B>-relief</B> option determines how the border
179 is to be drawn. The default is <I>2</I>. </DD>
180
181 <DT><B>-command <I>pattern</I></B> </DT>
182 <DD>Specifies to search for
183 a window whose <I>WM_COMMAND</I> property matches the given pattern (X11 only). If no windows,
184 or more than one window, matches the pattern, an error is generated. If
185 <I>pattern</I> is the empty string, then no command search is performed. The default
186 is <I>""</I>. </DD>
187
188 <DT><B>-cursor <I>cursor</I></B> </DT>
189 <DD>Specifies the widget's cursor. The default cursor is
190 <I>""</I>. </DD>
191
192 <DT><B>-height <I>pixels</I></B> </DT>
193 <DD>Specifies the requested height of widget. If <I>pixels</I> is
194 0, then the height is height the embedded window plus the specified borderwidth.
195 The default is <I>0</I>. </DD>
196
197 <DT><B>-highlightbackground <I>color</I></B> </DT>
198 <DD>Sets the color to display in
199 the traversal highlight region when the container does not have the input
200 focus. </DD>
201
202 <DT><B>-highlightcolor <I>color</I></B> </DT>
203 <DD>Sets the color to use for the traversal highlight
204 rectangle that is drawn around the widget when it has the input focus.
205 The default is <I>black</I>. </DD>
206
207 <DT><B>-highlightthickness <I>pixels</I></B> </DT>
208 <DD>Sets the width of the highlight
209 rectangle to draw around the outside of the widget when it has the input
210 focus. <I>Pixels</I> is a non-negative value and may have any of the forms acceptable
211 to <B>Tk_GetPixels</B>. If the value is zero, no focus highlight is drawn around
212 the widget. The default is <I>2</I>. </DD>
213
214 <DT><B>-name <I>pattern</I></B> </DT>
215 <DD>Specifies to search for a window
216 whose <I>WM_NAME</I> property matches the given pattern (X11 only). If no windows, or more
217 than one window, matches the pattern, an error is generated. If <I>pattern</I>
218 is the empty string, then no name search is performed. The default is <I>""</I>.
219 </DD>
220
221 <DT><B>-relief <I>relief</I></B> </DT>
222 <DD>Specifies the 3-D effect for the container widget. <I>Relief</I>
223 specifies how the container should appear relative to widget that it is
224 packed into; for example, <I>raised</I> means the container should appear to protrude.
225 The default is <I>sunken</I>. </DD>
226
227 <DT><B>-takefocus</B> <I>focus</I> </DT>
228 <DD>Provides information used when
229 moving the focus from window to window via keyboard traversal (e.g., Tab
230 and Shift-Tab). If <I>focus</I> is <I>0</I>, this means that this window should be skipped
231 entirely during keyboard traversal. <I>1</I> means that the this window should
232 always receive the input focus. An empty value means that the traversal
233 scripts decide whether to focus on the window. The default is <I>1</I>. </DD>
234
235 <DT><B>-width <I>pixels</I></B>
236 </DT>
237 <DD>Specifies the requested width of the widget. If <I>pixels</I> is 0, then the
238 width is the width the embedded window and the specified borderwidth. The
239 default is <I>0</I>. </DD>
240
241 <DT><B>-window <I>id</I></B> </DT>
242 <DD>Specifies the foreign embedded using its path or X window
243 id. </DD>
244 </DL>
245 </blockquote>
246
247 <DL>
248
249 <DT><I>pathName <B>find <B>-command</B></B></I>|<B>-name</B> <I>pattern</I> </DT>
250 <DD>Searches for all windows that match
251 the given pattern. If the <B>-command</B> switch is given, all windows whose WWM_COMMAND
252 property match <I>pattern</I> are returned in a list (X11 only). If the <B>-name</B> switch is given,
253 all windows whose WWM_NAME property match <I>pattern</I> are returned in a list.
254 The list returned will contains pairs of the window id and the matching
255 property. </DD>
256 </DL>
257
258 <H2><A NAME="sect7" HREF="#toc7">Keywords</A></H2>
259 container, widget <P>
260
261 <HR><P>
262 <A NAME="toc"><B>Table of Contents</B></A><P>
263 <UL>
264 <LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
265 <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
266 <LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
267 <LI><A NAME="toc3" HREF="#sect3">Introduction</A></LI>
268 <LI><A NAME="toc4" HREF="#sect4">Example</A></LI>
269 <LI><A NAME="toc5" HREF="#sect5">Syntax</A></LI>
270 <LI><A NAME="toc6" HREF="#sect6">Container Operations</A></LI>
271 <LI><A NAME="toc7" HREF="#sect7">Keywords</A></LI>
272 </UL>
273 </BODY></HTML>