File: Form.html

package info (click to toggle)
tix41 4.1.0.7-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,352 kB
  • ctags: 3,941
  • sloc: ansic: 29,223; tcl: 21,763; makefile: 1,987; sh: 1,978; cs: 150
file content (419 lines) | stat: -rw-r--r-- 15,621 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419



<TITLE>tixForm - Geometry manager based on attachment rules</TITLE>
<Center><H2>tixForm - Geometry manager based on attachment rules</H2></Center><hr>

</pre><H3>SYNOPSIS</H3>
<P>
<B>tixForm<I> option arg ?arg ...?</I></B>
</pre><HR>
<P>
</pre><H3>DESCRIPTION</H3>
<P>
The <B>tixForm</B></I> command is used to communicate with the
<B>tixForm</B></I> Geometry Manager, a geometry manager that arranges the
geometry of the children in a parent window according to attachment
rules. The <B>tixForm</B></I> geometry manager is very flexible and
powerful; it can be used to emulate all the existing features of the
Tk packer and placer geometry managers (see <B>pack(n)</B></I>,
<B>place(n)</B></I>).
The <B>tixForm</B></I> command can have any of several forms,
depending on the <I>option</I></B> argument:
<DL>
<DT> <B>tixForm<I> slave </I></B>?<I>options</I></B>?
</I></B>
<DD> If the first argument to <B>tixForm</B></I> is a window name (any value
<B>tixForm configure</B></I>.
</DL>
<DL>
<DT> <B>tixForm check <I>master</I></B>
</I></B>
<DD> This command checks whether there is circular dependency in the
DEPENDENCY</B></I> below). It returns the Boolean value <B>TRUE</B></I> if it
discover circular dependency and <B>FALSE</B></I> otherwise.
</DL>
<DL>
<DT> <B>tixForm configure<I> slave </I></B>?<I>-option value ...</I></B>?
</I></B>
<DD> Sets or adjusts the attachment values of the slave window
according to the <I>-option value</I></B> argument pairs. 
</DL>
<UL>
<DL>
<DT> <B>-b</B></I> <I>attachment</I></B>
</I></B>
<DD> Abbreviation for the <B>-bottom</B></I> option.
</DL>
<DL>
<DT> <B>-bottom</B></I> <I>attachment</I></B>
</I></B>
<DD> Specifies an attachment for the bottom edge of the slave window. The
attachment must specied according to the section <B>SPECIFYING
ATTACHMENTS</B></I> below.
</DL>
<DL>
<DT> <B>-bottomspring</B></I> <I>weight</I></B>
</I></B>
<DD> Specifies the weight of the spring at the bottom edge of the slave
window. See the section <B>USING SPRINGS</B></I> below.
</DL>
<DL>
<DT> <B>-bp</B></I> <I>value</I></B>
</I></B>
<DD> Abbreviation for the <B>-padbottom</B></I> option.
</DL>
<DL>
<DT> <B>-bs</B></I> <I>weight</I></B>
</I></B>
<DD> Abbreviation for the <B>-bottomspring</B></I> option.
</DL>
<DL>
<DT> <B>-fill</B></I> <I>master</I></B>
</I></B>
<DD> Specifies the fillings when springs are used for this widget. The
value must be <B>x</B></I>, <B>y</B></I>, <B>both</B></I> or <B>none</B></I>.
</DL>
<DL>
<DT> <B>-in</B></I> <I>master</I></B>
</I></B>
<DD> Places the slave window into the specified master window. If the slave
was originally in another master window, all attachment values with
respect to the original master window are discarded. Even if the
attachment values are the same as in the original master window, they
need to be specified again.  The <B>-in</B></I> flag, when needed, must appear
as the first flag after the name of the slave. Otherwise an error is
generated.
</DL>
<DL>
<DT> <B>-l</B></I> <I>attachment</I></B>
</I></B>
<DD> Abbreviation for the <B>-left</B></I> option.
</DL>
<DL>
<DT> <B>-left</B></I> <I>attachment</I></B>
</I></B>
<DD> Specifies an attachment for the left edge of the slave window. The
attachment must specied according to the section <B>SPECIFYING
ATTACHMENTS</B></I> below.
</DL>
<DL>
<DT> <B>-leftspring</B></I> <I>weight</I></B>
</I></B>
<DD> Specifies the weight of the spring at the left edge of the slave
window. See the section <B>USING SPRINGS</B></I> below.
</DL>
<DL>
<DT> <B>-lp</B></I> <I>value</I></B>
</I></B>
<DD> Abbreviation for the <B>-padleft</B></I> option.
</DL>
<DL>
<DT> <B>-ls</B></I> <I>weight</I></B>
</I></B>
<DD> Abbreviation for the <B>-leftspring</B></I> option.
</DL>
<DL>
<DT> <B>-padbottom</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on the bottom side
of the slave. The <I>value</I></B> may have any of the forms acceptable to
<B>Tk_GetPixels(3)</B></I>.
</DL>
<DL>
<DT> <B>-padleft</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on the left side of
the slave.
</DL>
<DL>
<DT> <B>-padright</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on the right side of
the slave.
</DL>
<DL>
<DT> <B>-padtop</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on the top side of
the slave.
</DL>
<DL>
<DT> <B>-padx</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on both the left and
the right sides of the slave.
</DL>
<DL>
<DT> <B>-pady</B></I> <I>value</I></B>
</I></B>
<DD> Specifies the amount of external padding to leave on both the top and
the bottom sides of the slave.
</DL>
<DL>
<DT> <B>-r</B></I> <I>attachment</I></B>
</I></B>
<DD> Abbreviation for the <B>-right</B></I> option.
</DL>
<DL>
<DT> <B>-right</B></I> <I>attachment</I></B>
</I></B>
<DD> Specifies an attachment for the right edge of the slave window. The
attachment must specied according to the section <B>SPECIFYING
ATTACHMENTS</B></I> below.
</DL>
<DL>
<DT> <B>-rightspring</B></I> <I>weight</I></B>
</I></B>
<DD> Specifies the weight of the spring at the right edge of the slave
window. See the section <B>USING SPRINGS</B></I> below.
</DL>
<DL>
<DT> <B>-rp</B></I> <I>value</I></B>
</I></B>
<DD> Abbreviation for the <B>-padright</B></I> option.
</DL>
<DL>
<DT> <B>-rs</B></I> <I>weight</I></B>
</I></B>
<DD> Abbreviation for the <B>-rightspring</B></I> option.
</DL>
<DL>
<DT> <B>-t</B></I> <I>attachment</I></B>
</I></B>
<DD> Abbreviation for the <B>-top</B></I> option.
</DL>
<DL>
<DT> <B>-top</B></I> <I>attachment</I></B>
</I></B>
<DD> Specifies an attachment for the top edge of the slave window. The
attachment must specied according to the section <B>SPECIFYING
ATTACHMENTS</B></I> below.
</DL>
<DL>
<DT> <B>-topspring</B></I> <I>weight</I></B>
</I></B>
<DD> Specifies the weight of the spring at the top edge of the slave
window. See the section <B>USING SPRINGS</B></I> below.
</DL>
<DL>
<DT> <B>-tp</B></I> <I>value</I></B>
</I></B>
<DD> Abbreviation for the <B>-padtop</B></I> option.
</DL>
<DL>
<DT> <B>-ts</B></I> <I>weight</I></B>
</I></B>
<DD> Abbreviation for the <B>-topspring</B></I> option.
</DL>
</UL>
<DL>
<DT> <B>tixForm forget<I> slave </I></B>?<I>slave ...</I></B>?
</I></B>
<DD> Removes each of the slaves from its master and unmaps their windows.
The slaves will no longer be managed by tixForm. All attachment values
with respect to their master windows are discarded. If another slave
is attached to this slave, then the attachment of the other slave will
be changed to grid attachment based on its geometry.
</DL>
<DL>
<DT> <B>tixForm grid <I>master </I></B>?<I>x_size y_size</I></B>?
</I></B>
<DD> When <I>x_size</I></B> and <I>y_size</I></B> are given, this command returns the
number of grids of the master window in a pair of integers of the form
{<I>x_size y_size</I></B>}. When both <I>x_size</I></B> and <I>y_size</I></B> are
given, this command changes the number of horizontal and vertical
grids on the master window.
</DL>
<DL>
<DT> <B>tixForm info<I> slave</I></B> ?<I>option</I></B>?
</I></B>
<DD> Queries the attachment options of a slave window. <I>option</I></B> can be
any of the options accepted by the <B>tixForm configure</B></I> command. If
<I>option</I></B> is given, only the value of that option is returned.
Otherwise, this command returns a list whose elements are the current
configuration state of the slave given in the same <I>option-value</I></B> form
that might be specified to <B>tixForm configure</B></I>. The first two
elements in this list list are "<B>-in<I> master</I></B>" where
</DL>
<DL>
<DT> <B>tixForm slaves <I>master</I></B>
</I></B>
<DD> Returns a list of all of the slaves for the master window. The order
of the slaves in the list is the same as their order in the packing
order. If master has no slaves then an empty string is returned.
</DL>
<P>
</pre><H3>SPECIFYING ATTACHMENTS</H3>
One can specify an attachment for each side of a slave window managed
by tixForm. An attachment is specified in the the form "-<I>side</I></B>
{<I>anchor_point</I></B> <I>offset</I></B>}". -<I>side</I></B> can be one of
<B>-top</B></I>, <B>-bottom</B></I>, <B>-left</B></I> or <B>-right</B></I>.
<P>
<I>Offset</I></B> is given in screen units (i.e. any of the forms
acceptable to <B>Tk_GetPixels</B></I>).  A positive offset indicates
shifting to a position to the right or bottom of an anchor point. A
negative offset indicates shifting to a position to the left or top of
an anchor point.
<P>
<I>Anchor_point</I></B> can be given in one of the
following forms:
<UL>
<DL>
<DT> <B>Grid Attachment</B></I>
</I></B>
<DD> The master window is divided into a number of horizontal and vertical
grids. By default the master window is divided into 100x100 grids; the
number of grids can be adjusted by the <B>tixForm grid</B></I> command. A
grid attachment anchor point is given by a <B>%</B></I> sign followed by an
<B>integer</B></I> value. For example, <B>%0</B></I> spceifies the first grid
line (the top or left edge of the master window). <B>%100</B></I> spceifies
the last grid line (the bottom or right edge of the master window). 
</DL>
<DL>
<DT> <B>Opposite Side Attachment</B></I>
</I></B>
<DD> Opposite attachment specifies an anchor point located on the
<B>opposite</B></I> side of another slave widget, which must be managed by
tixForm in the same master window. An opposite attachment anchor point
is given by the name of another widget. For example, "tixForm .b -top
{.a 0}" attaches the <B>top</B></I> side of the widget <B>\.b</B></I> to the
<B>bottom</B></I> of the widget <B>\.a</B></I>.
</DL>
<DL>
<DT> <B>Parallel Side Attachment</B></I>
</I></B>
<DD> Opposite attachment specifies an anchor point located on the
<B>same</B></I> side of another slave widget, which must be managed by
tixForm in the same master window. An parallel attachment anchor point
is given by the sign <B>&amp;</B></I> follwed by the name of another widget.
For example, "tixForm .b -top {&amp;.a 0}" attaches the <B>top</B></I> side of
the widget <B>\.b</B></I> to the <B>top</B></I> of the widget <B>\.a</B></I>, making
the <B>top</B></I> sides of these two widgets at the same vertical position
in their parent window.
</DL>
<DL>
<DT> <B>No Attachment</B></I>
</I></B>
<DD> Specifies a side of the slave to be attached to nothing, indicated by
the keyword <B>none</B></I>. When the <B>none</B></I> anchor point is given, the
offser must be zero.

When a side of a slave is attached to <B>{none 0}</B></I>, the position
of this side is calculated by the position of the other side and the
natural size of the slave. For example, if a the <B>left</B></I> side of a
widget is attached to <B>{%0 100}</B></I>, its <B>right</B></I> side attached to
<B>{none 0}</B></I>, and the natural size of the widget is <B>50</B></I> pixels,
the <B>right</B></I> side of the widget will be positioned at pixel <B>{%0
149}</B></I>.

When both <B>-top</B></I> and <B>-bottom</B></I> are attached to <B>none</B></I>,
then by default <B>-top</B></I> will be attached to <B>{%0 0}</B></I>. When both
<B>-left</B></I> and <B>-right</B></I> are attached to none, then by default
<B>-left</B></I> will be attached to <B>{%0 0}</B></I>.
</DL>
</UL>
<P>
Shifting effects can be achieved by specifying a non-zero offset with
an anchor point. In the following example, the <B>top</B></I> side of
widget <B>\.b</B></I> is attached to the <B>bottom</B></I> of <B>\.a</B></I>; hence <B>\.b</B></I> 
always appears below <B>\.a</B></I>.  Also, the left edge of <B>\.b</B></I>
is attached to the <B>left</B></I> side of <B>\.a</B></I> with a 10
pixel offest.  Therefore, the <B>left</B></I> edge of <B>\.b</B></I> is always
<P>
<pre><code><code><code>
        tixForm .b -left {.a 10} -top {.a 0}
</code></code></code></pre>
<P>
<B>ABBREVIATIONS:</B></I> Certain abbreviations can be made on the
attachment specifications: First an offset of zero can be omitted.
Thus, the following two lines are equivalent:
<P>
<pre><code><code><code>
        tixForm .b -top {.a 0} -right {%100 0}
        tixForm .b -top {.a}   -right {%100}
</code></code></code></pre>
<P>
Also, because of the way TCL handles lists, when you omit the offset,
you can also leave out the braces. So you can further simplify the
above to:
<P>
<pre><code><code><code>
        tixForm .b -top .a -right %100
</code></code></code></pre>
<P>
In the second case, when the anchor point is omitted, the offset must
be given. A default anchor point is chosen according to the value of
the offset. If the anchor point is <B>0</B></I> or positive, the default
anchor point %0 is used; thus, "tixForm \.b -top 15" attaches the top
edge of <B>\.b</B></I> to a position 15 pixels below the top edge of the
master window. If the anchor point is "<B>-0</B></I>" or negative, the
default anchor point <B>%100</B></I> is used; thus, "tixForm \.a -right
-2" attaches the right edge of <B>\.a</B></I> to a position 2 pixels to
below shows a command with its equivalent abbreviation.
<P>
<pre><code><code><code>
        tixForm .b -top {%0 10} -bottom {%100 0}
        tixForm .b -top 10      -bottom -0
</code></code></code></pre>
<P>
</pre><H3>USING SPRINGS</H3>
To be written.
<P>
</pre><H3>ALGORITHM OF TIXFORM</H3>
TixForm starts with any slave in the list of slaves of the master
window. Then it tries to determine the position of each side of the
slave.
<P>
If the attachment of a side of the slave is grid attachment, the
position of the side is readily determined.
<P>
If the attachment of this side is <B>none</B></I>, then tixForm tries to
determine the position of the opposite side first, and then use the
position of the opposite side and the natural size of the slave to
determine the position of this side.
<P>
If the attachment is opposite or parallel widget attachments, then
tixForm tries to determine the positions of the other widget first,
and then use the positions of the other widget and the natural size of
the slave determine the position of this side. This recursive
algorithmis carried on until the positions of all slaves are
determined.
<P>
</pre><H3>CIRCULAR DEPENDENCY</H3>
<P>
The algorithm of tixForm will fail if a circular dependency exists in
the attachments of the slaves. For example:
<P>
<pre><code><code><code>
	tixForm .c -left .b
	tixForm .b -right .c
</code></code></code></pre>
<P>
In this example, the position of the left side of <B>.b</B></I> depends on
the right side of <B>.c</B></I>, which in turn depends on the left side of <B>.b</B></I>.
<P>
When a circular dependency is discovered during the execution of the
tixForm algorithm, tixForm will generate a background error and the
geometry of the slaves are undefined (and will be arbitrary). Notice
that tixForm only executes the algorithm when the specification of the
attachments.  Also, unlike the Motif Form manager widget, tixForm
defines circular dependency as "<I>dependency in the same
dimension</B></I>". Therefore, the following code fragment will does not
have circular dependency because the two widgets do not depend on each
other in the same dimension (<B>\.b</B></I> depends <B>.c</B></I> in the
horizontal dimension and <B>.c</B></I> depends on <B>.b</B></I> in the vertical
dimension):
<P>
<pre><code><code><code>
        tixForm .b -left .c
        tixForm .c -top .b
</code></code></code></pre>
<P>
</pre><H3>BUGS</H3>
<P>
Springs have not been fully implemented yet.
</pre><H3>KEYWORDS</H3>
Tix(n), Form, Geometry Management
<hr><i>Last modified Sun Jan 19 22:34:27 EST 1997 </i> --- 
<i>Serial 853731299</i>