1<sect1 id="Form_Widget">
2<title>Form Widget</title>
3<para>
4<!-- .LP -->
5<!-- .XS -->
6<!-- 	Form Widget -->
7<!-- .XE -->
8<indexterm significance="preferred"><primary>Form widget</primary></indexterm>
9<literallayout class="monospaced">
10<!-- .TA 2.0i -->
11<!-- .ta 2.0i -->
12<!-- .sp -->
13Application Header file	&lt;X11/Xaw/Form.h&gt;
14<indexterm><primary>Form.h</primary></indexterm>
15Class Header file	&lt;X11/Xaw/FormP.h&gt;
16<indexterm><primary>FormP.h</primary></indexterm>
17Class		formWidgetClass
18<indexterm><primary>formWidgetClass</primary></indexterm>
19Class Name	Form
20<indexterm><primary>Form widget</primary><secondary>class name</secondary></indexterm>
21Superclass	Constraint
22<!-- .sp -->
23</literallayout>
24</para>
25<para>
26<!-- .LP -->
27The Form widget can contain an arbitrary number of children or
28subwidgets.  The Form provides geometry management for its children,
29which allows individual control of the position of each child.  Any
30combination of children can be added to a Form.  The initial positions
31of the children may be computed relative to the positions of previously
32created children.  When the Form is resized, it computes new positions and
33sizes for its children.  This computation is based upon information
34provided when a child is added to the Form.
35</para>
36<para>
37<!-- .LP -->
38The default width of the Form is the minimum width needed to
39enclose the children after computing their initial layout, with a
40margin of <function>defaultDistance</function>
41at the right and bottom edges.  If a width and height is assigned
42to the Form that is too small for the layout, the children will
43be clipped by the right and bottom edges of the Form.
44</para>
45<sect2 id='Form::Resources'>
46<title>Resources</title>
47<para>
48<!-- .LP -->
49When creating a Form widget instance, the following resources are
50retrieved from the argument list or from the resource database:
51</para>
52<para>
53<!-- .LP -->
54<indexterm><primary>Form widget</primary><secondary>resources</secondary></indexterm>
55<informaltable>
56  <tgroup cols='5' align='center'>
57  <colspec colname='c1'/>
58  <colspec colname='c2'/>
59  <colspec colname='c3'/>
60  <colspec colname='c4'/>
61  <colspec colname='c5'/>
62  <thead>
63    <row>
64      <entry>Name</entry>
65      <entry>Class</entry>
66      <entry>Type</entry>
67      <entry>Notes</entry>
68      <entry>Default Value</entry>
69    </row>
70  </thead>
71  <tbody>
72    <row>
73      <entry>accelerators</entry>
74      <entry>Accelerators</entry>
75      <entry>AcceleratorTable</entry>
76      <entry></entry>
77      <entry>NULL</entry>
78    </row>
79    <row>
80      <entry>ancestorSensitive</entry>
81      <entry>AncestorSensitive</entry>
82      <entry>Boolean</entry>
83      <entry>D</entry>
84      <entry>True</entry>
85    </row>
86    <row>
87      <entry>background</entry>
88      <entry>Background</entry>
89      <entry>Pixel</entry>
90      <entry></entry>
91      <entry>XtDefaultBackground</entry>
92    </row>
93    <row>
94      <entry>backgroundPixmap</entry>
95      <entry>Pixmap</entry>
96      <entry>Pixmap</entry>
97      <entry></entry>
98      <entry>XtUnspecifiedPixmap</entry>
99    </row>
100    <row>
101      <entry>borderColor</entry>
102      <entry>BorderColor</entry>
103      <entry>Pixel</entry>
104      <entry></entry>
105      <entry>XtDefaultForeground</entry>
106    </row>
107    <row>
108      <entry>borderPixmap</entry>
109      <entry>Pixmap</entry>
110      <entry>Pixmap</entry>
111      <entry></entry>
112      <entry>XtUnspecifiedPixmap</entry>
113    </row>
114    <row>
115      <entry>borderWidth</entry>
116      <entry>BorderWidth</entry>
117      <entry>Dimension</entry>
118      <entry></entry>
119      <entry>1</entry>
120    </row>
121    <row>
122      <entry>children</entry>
123      <entry>ReadOnly</entry>
124      <entry>WidgetList</entry>
125      <entry>R</entry>
126      <entry>NULL</entry>
127    </row>
128    <row>
129      <entry>colormap</entry>
130      <entry>Colormap</entry>
131      <entry>Colormap</entry>
132      <entry></entry>
133      <entry>Parent's Colormap</entry>
134    </row>
135    <row>
136      <entry>defaultDistance</entry>
137      <entry>Thickness</entry>
138      <entry>int</entry>
139      <entry></entry>
140      <entry>4</entry>
141    </row>
142    <row>
143      <entry>depth</entry>
144      <entry>Depth</entry>
145      <entry>int</entry>
146      <entry>C</entry>
147      <entry>Parent's Depth</entry>
148    </row>
149    <row>
150      <entry>destroyCallback</entry>
151      <entry>Callback</entry>
152      <entry>XtCallbackList</entry>
153      <entry></entry>
154      <entry>NULL</entry>
155    </row>
156    <row>
157      <entry>height</entry>
158      <entry>Height</entry>
159      <entry>Dimension</entry>
160      <entry>A</entry>
161      <entry>Enough space to contain all children</entry>
162    </row>
163    <row>
164      <entry>mappedWhenManaged</entry>
165      <entry>MappedWhenManaged</entry>
166      <entry>Boolean</entry>
167      <entry></entry>
168      <entry>True</entry>
169    </row>
170    <row>
171      <entry>numChildren</entry>
172      <entry>ReadOnly</entry>
173      <entry>Cardinal</entry>
174      <entry>R</entry>
175      <entry>0</entry>
176    </row>
177    <row>
178      <entry>screen</entry>
179      <entry>Screen</entry>
180      <entry>Screen</entry>
181      <entry>R</entry>
182      <entry>Parent's Screen</entry>
183    </row>
184    <row>
185      <entry>sensitive</entry>
186      <entry>Sensitive</entry>
187      <entry>Boolean</entry>
188      <entry></entry>
189      <entry>True</entry>
190    </row>
191    <row>
192      <entry>translations</entry>
193      <entry>Translations</entry>
194      <entry>TranslationTable</entry>
195      <entry></entry>
196      <entry>NULL</entry>
197    </row>
198    <row>
199      <entry>width</entry>
200      <entry>Width</entry>
201      <entry>Dimension</entry>
202      <entry>A</entry>
203      <entry>Enough space to contain all children</entry>
204    </row>
205    <row>
206      <entry>x</entry>
207      <entry>Position</entry>
208      <entry>Position</entry>
209      <entry></entry>
210      <entry>0</entry>
211    </row>
212    <row>
213      <entry>y</entry>
214      <entry>Position</entry>
215      <entry>Position</entry>
216      <entry></entry>
217      <entry>0</entry>
218    </row>
219    <row>
220      <entry>_</entry>
221    </row>
222  </tbody>
223  </tgroup>
224</informaltable>
225<!-- .Ac -->
226<!-- .As -->
227<!-- .Bg -->
228<!-- .Gp -->
229<!-- .Bc -->
230<!-- .Bp -->
231<!-- .Bw -->
232<!-- .Ch -->
233<!-- .Cm -->
234<!-- .Dd Bold -->
235<!-- .Dp -->
236<!-- .Dc -->
237<!-- .Hw -->
238<!-- .Mm -->
239<!-- .Nc -->
240<!-- .Sc -->
241<!-- .Se -->
242<!-- .Tr -->
243<!-- .Xy -->
244</para>
245</sect2>
246<sect2 id='Form::Constraint_Resources'>
247<title>Constraint Resources</title>
248<para>
249<!-- .LP -->
250<indexterm><primary>Form widget</primary><secondary>constraint resources</secondary></indexterm>
251Each child of the Form widget may request special layout resources
252be applied to it.  These <emphasis remap='I'>constraint</emphasis> resources allow the Form
253widget's children to specify individual layout requirements.
254</para>
255<para>
256<!-- .LP -->
257</para>
258<para>
259<!-- .LP -->
260<informaltable>
261  <tgroup cols='5' align='center'>
262  <colspec colname='c1'/>
263  <colspec colname='c2'/>
264  <colspec colname='c3'/>
265  <colspec colname='c4'/>
266  <colspec colname='c5'/>
267  <thead>
268    <row>
269      <entry>Name</entry>
270      <entry>Class</entry>
271      <entry>Type</entry>
272      <entry>Notes</entry>
273      <entry>Default Value</entry>
274    </row>
275  </thead>
276  <tbody>
277    <row>
278      <entry>bottom</entry>
279      <entry>Edge</entry>
280      <entry>XawEdgeType</entry>
281      <entry></entry>
282      <entry>XawRubber</entry>
283    </row>
284    <row>
285      <entry>fromHoriz</entry>
286      <entry>Widget</entry>
287      <entry>Widget</entry>
288      <entry></entry>
289      <entry>NULL (left edge of Form)</entry>
290    </row>
291    <row>
292      <entry>fromVert</entry>
293      <entry>Widget</entry>
294      <entry>Widget </entry>
295      <entry></entry>
296      <entry>NULL (top edge of Form)</entry>
297    </row>
298    <row>
299      <entry>horizDistance</entry>
300      <entry>Thickness</entry>
301      <entry>int</entry>
302      <entry></entry>
303      <entry><function>defaultDistance</function> resource</entry>
304    </row>
305    <row>
306      <entry>left</entry>
307      <entry>Edge</entry>
308      <entry>XawEdgeType</entry>
309      <entry></entry>
310      <entry>XawRubber</entry>
311    </row>
312    <row>
313      <entry>resizable</entry>
314      <entry>Boolean</entry>
315      <entry>Boolean</entry>
316      <entry></entry>
317      <entry>FALSE</entry>
318    </row>
319    <row>
320      <entry>right</entry>
321      <entry>Edge</entry>
322      <entry>XawEdgeType</entry>
323      <entry></entry>
324      <entry>XawRubber</entry>
325    </row>
326    <row>
327      <entry>top</entry>
328      <entry>Edge</entry>
329      <entry>XawEdgeType</entry>
330      <entry></entry>
331      <entry>XawRubber</entry>
332    </row>
333    <row>
334      <entry>vertDistance</entry>
335      <entry>Thickness</entry>
336      <entry>int</entry>
337      <entry></entry>
338      <entry><function>defaultDistance</function> resource</entry>
339    </row>
340  </tbody>
341  </tgroup>
342</informaltable>
343<!-- .Bt Bold -->
344<!-- .Fh Bold -->
345<!-- .Hd Bold -->
346<!-- .Rl Bold -->
347</para>
348<literallayout class="monospaced">
349bottom
350left
351right
352top            What to do with this edge of the child when
353               the parent is resized.  This resource may be
354               any edgeType.  See Layout Semantics for
355               details.
356
357fromHoriz
358fromVert       Which widget this child should be placed
359               underneath (or to the right of).  If a value
360               of NULL is specified then this widget will be
361               positioned relative to the edge of the par-
362               ent.
363
364horizDistance
365vertDistance   The amount of space, in pixels, between this
366               child and its left or upper neighbor.
367
368resizable      If this resource is False then the parent
369               widget will ignore all geometry request made
370               by this child.  The parent may still resize
371               this child itself, however.
372</literallayout>
373<!-- .Bt -->
374</sect2>
375<sect2 id='Form::Layout_Semantics'>
376<title>Layout Semantics</title>
377<para>
378The Form widget uses two different sets of layout semantics.
379One is used when initially laying out the children.  The
380other is used when the Form is resized.
381</para>
382<para>
383The first layout method uses the <function>fromVert</function>
384and <function>fromHoriz</function>
385resources to place the children of the Form.  A single pass
386is made through the Form widget's children in the order that
387they were created.  Each child is then placed in the Form
388widget below or to the right of the widget specified by the
389<function>fromVert</function> and <function>fromHoriz</function>
390resources.  The distance the new
391child is placed from its left or upper neighbor is deter-
392mined by the <function>horizDistance</function> and
393<function>vertDistance</function> resources.  This
394implies some things about how the order of creation affects
395the possible placement of the children.  The Form widget
396registers a string to widget converter which does not post-
397pone conversion and does not cache conversion results.
398</para>
399<para>
400The second layout method is used when the Form is resized.
401It does not matter what causes this resize, and it is possi-
402ble for a resize to happen before the widget becomes visible
403(due to constraints imposed by the parent of the Form).
404This layout method uses the <function>bottom</function>,
405<function>top</function>, <function>left</function>, and
406<function>right</function>
407resources.  These resources are used to determine what will
408happen to each edge of the child when the Form is resized.
409If a value of <function>XawChain</function>
410&lt;<emphasis remap='I'>something</emphasis>&gt; is specified, the the edge
411of the child will remain a fixed distance from the
412<emphasis remap='I'>chain</emphasis>
413edge of the Form.  For example if <function>XawChainLeft</function> is specified
414for the <function>right</function> resource of a child then the right edge of
415that child will remain a fixed distance from the left edge
416of the Form widget.  If a value of <function>XawRubber</function> is specified,
417that edge will grow by the same percentage that the Form
418grew.  For instance if the Form grows by 50% the left edge
419of the child (if specified as <function>XawRubber</function> will be 50% farther
420from the left edge of the Form).  One must be very careful
421when specifying these resources, for when they are specified
422incorrectly children may overlap or completely occlude other
423children when the Form widget is resized.
424<!-- .LP -->
425<!-- .Lt Form -->
426</para>
427<para>
428<!-- .LP -->
429<informaltable>
430  <tgroup cols='3' align='center'>
431  <colspec colname='c1'/>
432  <colspec colname='c2'/>
433  <colspec colname='c3'/>
434  <thead>
435    <row>
436      <entry>Edge Type</entry>
437      <entry>Resource Name</entry>
438      <entry>Description</entry>
439    </row>
440  </thead>
441  <tbody>
442    <row>
443      <entry>XawChainBottom</entry>
444      <entry>ChainBottom</entry>
445      <entry>Edge remains a fixed distance from bottom of Form</entry>
446    </row>
447    <row>
448      <entry>XawChainLeft</entry>
449      <entry>ChainLeft</entry>
450      <entry>Edge remains a fixed distance from left of Form</entry>
451    </row>
452    <row>
453      <entry>XawChainRight</entry>
454      <entry>ChainRight</entry>
455      <entry>Edge remains a fixed distance from right of Form</entry>
456    </row>
457    <row>
458      <entry>XawChainTop</entry>
459      <entry>ChainTop</entry>
460      <entry>Edge remains a fixed distance from top of Form</entry>
461    </row>
462    <row>
463      <entry>XawRubber</entry>
464      <entry>Rubber</entry>
465      <entry>Edges will move a proportional distance</entry>
466    </row>
467  </tbody>
468  </tgroup>
469</informaltable>
470</para>
471<sect3 id='Form::Example'>
472<title>Example</title>
473<para>
474<!-- .LP -->
475If you wish to force the Form to never resize one or more of its
476children, then set <function>left</function> and <function>right</function> to <function>XawChainLeft</function> and
477<function>top</function> and <function>bottom</function> to <function>XawChainTop</function>.  This will cause the
478child to remain a fixed distance from the top and left edges of the
479Form, and never to resize.
480</para>
481</sect3>
482</sect2>
483<sect2 id='Form::Convenience_Routines'>
484<title>Convenience Routines</title>
485<para>
486<!-- .LP -->
487To force or defer a re-layout of the Form, use
488<!-- .PN XawFormDoLayout . -->
489<indexterm><primary>Form widget</primary><secondary>re-layout</secondary></indexterm>
490<indexterm significance="preferred"><primary>XawFormDoLayout</primary></indexterm>
491<funcsynopsis id='XawFormDoLayout'>
492<funcprototype>
493  <funcdef>void<function> XawFormDoLayout</function></funcdef>
494  <paramdef>Widget<parameter> w</parameter></paramdef>
495  <paramdef>Boolean<parameter> do_layout</parameter></paramdef>
496</funcprototype>
497</funcsynopsis>
498<!-- .FN -->
499<variablelist>
500  <varlistentry>
501    <term>
502      <emphasis remap='I'>w</emphasis>
503    </term>
504    <listitem>
505      <para>
506Specifies the Form widget.
507      </para>
508    </listitem>
509  </varlistentry>
510  <varlistentry>
511    <term>
512      <emphasis remap='I'>do_layout</emphasis>
513    </term>
514    <listitem>
515      <para>
516Specifies whether the layout of the Form widget is enabled (<function>True</function>)
517or disabled (<function>False</function>).
518    </para>
519  </listitem>
520  </varlistentry>
521</variablelist>
522</para>
523<para>
524<!-- .LP -->
525When making several changes to the children of a Form widget
526after the Form has been realized, it is a good idea to disable
527relayout until after all changes have been made.
528
529</para>
530</sect2>
531</sect1>
532