[comp.windows.x] Motif Form Widget

vania@osf.ORG (Vania Joloboff) (06/12/90)

There has been a number of questions on the net concerning the Form
widget. We expect the following guidelines, which will be added to 1.1
documentation, will help XmForm users.

1.  Every child should have an attachment either on the left or the right.
    If initialization or XtSetValues leaves a widget without
    such an attachment, the result depends upon the value of
    XmNrubberPositioning.

    If XmNrubberPositioning is false, it is given an XmNleftAttchment of
    XmATTACH_FORM, and an XmNleftOffset equal to its current x value.

    If XmNrubberPositioning is true, it is given an XmNleftAttachment of
    XmATTACH_POSITION, with an XmNleftPosition that corresponds to the
    percentage of its x value relative to the width of the form.   

    In either case, if the child has not been previously given an x value,
    its x value will be taken to be 0, which will place it at the left side
    of the form.

2.  If you want to create a child without any attachments, and then
    later (e.g. after creating and managing it, but before realizing it),
    give it a right attachment via XtSetValues, rememeber to set
    its XmNleftAttachment to XmATTACH_NONE at the same time (because
    in previous step, it may have been defaulted to left).

3.  The XmNresizable resource controls only whether a geometry request
    by the child will be granted.  It has no effect on whether the
    child's size can be changed because of changes in geometry of the
    form or of other children.

4.  If a child has attachments on both the left and the right sides,
    its size is completely controlled by the form.  It can be shrunk
    below its minimum size, and geometry requests to change its width
    may be refused.

5.  If a child has attachments on only its left or right side, it will
    stay at its preferred width.  This may cause it to be clipped by the
    form or by other children.

6.  If a child's left (or right) attachment is set to XmATTACH_SELF, the
    attachment is converted to an attachment of XmATTACH_POSITION, with a
    position that corresponds to x value of its left (or right) edge.
    To fix the position of a side at a specific x use XmATTACH_FORM
    (or XmATTACH_OPPOSITE_FORM) with the x value as the left (or right)
    offset.

7.  Unmapping a child has no effect on the form except that the child
    is not mapped.

8.  Unmanaging a child unmaps it.  If no other child is attached to it,
    or if all children attached to it, and all children recursively
    attached to them are also all unmanaged, then all of those children
    are treated as if they did not exist in determining the size of the
    form.

9.  To change the x value of a child you should simultaneously set its
    left attachment to either XmATTACH_SELF or XmATTACH_NONE.
    Otherwise, the request may not be granted.  If resizable is
    false, the request will only be granted if the child's size can
    remain the same.
    
All of the above is true of top and bottom attachments as well with
top acting like left and bottom acting like right.