1 <sect1 id="Form_Widget">
2 <title>Form Widget</title>
8 <!-- .IN "Form widget" "" "@DEF@" -->
9 <literallayout class="monospaced">
13 Application Header file <X11/Xaw/Form.h>
14 <!-- .IN "Form.h" "" -->
15 Class Header file <X11/Xaw/FormP.h>
16 <!-- .IN "FormP.h" "" -->
18 <!-- .IN "formWidgetClass" "" -->
20 <!-- .IN "Form widget" "class name" -->
27 The Form widget can contain an arbitrary number of children or
28 subwidgets. The Form provides geometry management for its children,
29 which allows individual control of the position of each child. Any
30 combination of children can be added to a Form. The initial positions
31 of the children may be computed relative to the positions of previously
32 created children. When the Form is resized, it computes new positions and
33 sizes for its children. This computation is based upon information
34 provided when a child is added to the Form.
38 The default width of the Form is the minimum width needed to
39 enclose the children after computing their initial layout, with a
40 margin of <function>defaultDistance</function>
41 at the right and bottom edges. If a width and height is assigned
42 to the Form that is too small for the layout, the children will
43 be clipped by the right and bottom edges of the Form.
45 <sect2 id='Form::Resources'>
46 <title>Resources</title>
49 When creating a Form widget instance, the following resources are
50 retrieved from the argument list or from the resource database:
54 <!-- .IN "Form widget" "resources" -->
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'/>
68 <entry>Default Value</entry>
73 <entry>accelerators</entry>
74 <entry>Accelerators</entry>
75 <entry>AcceleratorTable</entry>
80 <entry>ancestorSensitive</entry>
81 <entry>AncestorSensitive</entry>
82 <entry>Boolean</entry>
87 <entry>background</entry>
88 <entry>Background</entry>
91 <entry>XtDefaultBackground</entry>
94 <entry>backgroundPixmap</entry>
98 <entry>XtUnspecifiedPixmap</entry>
101 <entry>borderColor</entry>
102 <entry>BorderColor</entry>
105 <entry>XtDefaultForeground</entry>
108 <entry>borderPixmap</entry>
109 <entry>Pixmap</entry>
110 <entry>Pixmap</entry>
112 <entry>XtUnspecifiedPixmap</entry>
115 <entry>borderWidth</entry>
116 <entry>BorderWidth</entry>
117 <entry>Dimension</entry>
122 <entry>children</entry>
123 <entry>ReadOnly</entry>
124 <entry>WidgetList</entry>
129 <entry>colormap</entry>
130 <entry>Colormap</entry>
131 <entry>Colormap</entry>
133 <entry>Parent's Colormap</entry>
136 <entry>defaultDistance</entry>
137 <entry>Thickness</entry>
147 <entry>Parent's Depth</entry>
150 <entry>destroyCallback</entry>
151 <entry>Callback</entry>
152 <entry>XtCallbackList</entry>
157 <entry>height</entry>
158 <entry>Height</entry>
159 <entry>Dimension</entry>
161 <entry>Enough space to contain all children</entry>
164 <entry>mappedWhenManaged</entry>
165 <entry>MappedWhenManaged</entry>
166 <entry>Boolean</entry>
171 <entry>numChildren</entry>
172 <entry>ReadOnly</entry>
173 <entry>Cardinal</entry>
178 <entry>screen</entry>
179 <entry>Screen</entry>
180 <entry>Screen</entry>
182 <entry>Parent's Screen</entry>
185 <entry>sensitive</entry>
186 <entry>Sensitive</entry>
187 <entry>Boolean</entry>
192 <entry>translations</entry>
193 <entry>Translations</entry>
194 <entry>TranslationTable</entry>
201 <entry>Dimension</entry>
203 <entry>Enough space to contain all children</entry>
207 <entry>Position</entry>
208 <entry>Position</entry>
214 <entry>Position</entry>
215 <entry>Position</entry>
246 <sect2 id='Form::Constraint_Resources'>
247 <title>Constraint Resources</title>
250 <!-- .IN "Form widget" "constraint resources" -->
251 Each child of the Form widget may request special layout resources
252 be applied to it. These <emphasis remap='I'>constraint</emphasis> resources allow the Form
253 widget's children to specify individual layout requirements.
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'/>
273 <entry>Default Value</entry>
278 <entry>bottom</entry>
280 <entry>XawEdgeType</entry>
282 <entry>XawRubber</entry>
285 <entry>fromHoriz</entry>
286 <entry>Widget</entry>
287 <entry>Widget</entry>
289 <entry>NULL (left edge of Form)</entry>
292 <entry>fromVert</entry>
293 <entry>Widget</entry>
294 <entry>Widget </entry>
296 <entry>NULL (top edge of Form)</entry>
299 <entry>horizDistance</entry>
300 <entry>Thickness</entry>
303 <entry><function>defaultDistance</function> resource</entry>
308 <entry>XawEdgeType</entry>
310 <entry>XawRubber</entry>
313 <entry>resizable</entry>
314 <entry>Boolean</entry>
315 <entry>Boolean</entry>
322 <entry>XawEdgeType</entry>
324 <entry>XawRubber</entry>
329 <entry>XawEdgeType</entry>
331 <entry>XawRubber</entry>
334 <entry>vertDistance</entry>
335 <entry>Thickness</entry>
338 <entry><function>defaultDistance</function> resource</entry>
348 <literallayout class="monospaced">
352 top 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
358 fromVert 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-
365 vertDistance The amount of space, in pixels, between this
366 child and its left or upper neighbor.
368 resizable 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.
375 <sect2 id='Form::Layout_Semantics'>
376 <title>Layout Semantics</title>
378 The Form widget uses two different sets of layout semantics.
379 One is used when initially laying out the children. The
380 other is used when the Form is resized.
383 The first layout method uses the <function>fromVert</function>
384 and <function>fromHoriz</function>
385 resources to place the children of the Form. A single pass
386 is made through the Form widget's children in the order that
387 they were created. Each child is then placed in the Form
388 widget below or to the right of the widget specified by the
389 <function>fromVert</function> and <function>fromHoriz</function>
390 resources. The distance the new
391 child is placed from its left or upper neighbor is deter-
392 mined by the <function>horizDistance</function> and
393 <function>vertDistance</function> resources. This
394 implies some things about how the order of creation affects
395 the possible placement of the children. The Form widget
396 registers a string to widget converter which does not post-
397 pone conversion and does not cache conversion results.
400 The second layout method is used when the Form is resized.
401 It does not matter what causes this resize, and it is possi-
402 ble for a resize to happen before the widget becomes visible
403 (due to constraints imposed by the parent of the Form).
404 This layout method uses the <function>bottom</function>,
405 <function>top</function>, <function>left</function>, and
406 <function>right</function>
407 resources. These resources are used to determine what will
408 happen to each edge of the child when the Form is resized.
409 If a value of <function>XawChain</function>
410 <<emphasis remap='I'>something</emphasis>> is specified, the the edge
411 of the child will remain a fixed distance from the
412 <emphasis remap='I'>chain</emphasis>
413 edge of the Form. For example if <function>XawChainLeft</function> is specified
414 for the <function>right</function> resource of a child then the right edge of
415 that child will remain a fixed distance from the left edge
416 of the Form widget. If a value of <function>XawRubber</function> is specified,
417 that edge will grow by the same percentage that the Form
418 grew. For instance if the Form grows by 50% the left edge
419 of the child (if specified as <function>XawRubber</function> will be 50% farther
420 from the left edge of the Form). One must be very careful
421 when specifying these resources, for when they are specified
422 incorrectly children may overlap or completely occlude other
423 children when the Form widget is resized.
430 <tgroup cols='3' align='center'>
431 <colspec colname='c1'/>
432 <colspec colname='c2'/>
433 <colspec colname='c3'/>
436 <entry>Edge Type</entry>
437 <entry>Resource Name</entry>
438 <entry>Description</entry>
443 <entry>XawChainBottom</entry>
444 <entry>ChainBottom</entry>
445 <entry>Edge remains a fixed distance from bottom of Form</entry>
448 <entry>XawChainLeft</entry>
449 <entry>ChainLeft</entry>
450 <entry>Edge remains a fixed distance from left of Form</entry>
453 <entry>XawChainRight</entry>
454 <entry>ChainRight</entry>
455 <entry>Edge remains a fixed distance from right of Form</entry>
458 <entry>XawChainTop</entry>
459 <entry>ChainTop</entry>
460 <entry>Edge remains a fixed distance from top of Form</entry>
463 <entry>XawRubber</entry>
464 <entry>Rubber</entry>
465 <entry>Edges will move a proportional distance</entry>
471 <sect3 id='Form::Example'>
472 <title>Example</title>
475 If you wish to force the Form to never resize one or more of its
476 children, 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
478 child to remain a fixed distance from the top and left edges of the
479 Form, and never to resize.
483 <sect2 id='Form::Convenience_Routines'>
484 <title>Convenience Routines</title>
487 To force or defer a re-layout of the Form, use
488 <!-- .PN XawFormDoLayout . -->
489 <!-- .IN "Form widget" "re-layout" -->
490 <!-- .IN "XawFormDoLayout" "" "@DEF@" -->
491 <funcsynopsis id='XawFormDoLayout'>
493 <funcdef>void<function> XawFormDoLayout</function></funcdef>
494 <paramdef>Widget<parameter> w</parameter></paramdef>
495 <paramdef>Boolean<parameter> do_layout</parameter></paramdef>
502 <emphasis remap='I'>w</emphasis>
506 Specifies the Form widget.
512 <emphasis remap='I'>do_layout</emphasis>
516 Specifies whether the layout of the Form widget is enabled (<function>True</function>)
517 or disabled (<function>False</function>).
525 When making several changes to the children of a Form widget
526 after the Form has been realized, it is a good idea to disable
527 relayout until after all changes have been made.