Adding the form
Place a form on the free-form surface outside the window part and size it so that Label1 and its text part just fit inside it. Move the two parts onto the form, and then move the form into the window part where the parts used to be.
The form's parent is the window part, and Label1 and its text part now have the form as their parent, rather than the window part.
First attach the form as follows:
Edge
Attachment
Top
Attachment type: XmATTACHFORM
Offset: 10
Bottom
Attachment type: XmATTACHSELFOPPOSITE
Left
Attachment type: XmATTACHFORM
Offset: 10
Right
Attachment type: XmATTACHFORM
Offset: 10
Notice that the top, left, and right edges are attached to the window part and the bottom edge is unattached.
Attach Label1 as follows:
Edge
Attachment
Top
Attachment type: XmATTACHNONE
Bottom
Attachment type: XmATTACHFORM
Offset: 0
Left
Attachment type: XmATTACHFORM
Offset: 0
Right
Attachment type: XmATTACHNONE
Notice that the left and bottom edges are attached to the form and the top and right edges are unattached.
Attach the text part as follows:
Edge
Attachment
Top
Attachment type: XmATTACHNONE
Bottom
Attachment type: XmATTACHFORM
Offset: 0
Left
Attachment type: XmATTACHWIDGET
Offset: 10
Attached parts: Label1
Right
Attachment type: XmATTACHFORM
Offset: 0
Notice when you set the Attached parts for the left edge attachment that only Label1 is in the Target parts drop-down list, because it is the only other child of the form.
Notice that the left edge is attached to Label1, the right and bottom edges are attached to the form, and the top edge is unattached.
Before, the top edges of Label1 and its text part were attached and the bottom edges were unattached. Now, within the form, the bottom edges are attached and the top edges are unattached. This is simply a matter of preference: if the user changes the font size so that one part is larger than the other, a label and a text part side by side look more pleasing with their bottom edges aligned than with their top edges aligned.
Place Label2 and its text part on a form by repeating the same process. Attach the top edge of the second form to the bottom edge of the first form, offset by 10.
Before you finish, be sure to attach the top edge of Label3 to the bottom edge of the second form, offset by 10.
As you have probably noticed, there are many different ways you could set up the sizing and positioning for windows. The techniques covered in these sections have a number of powerful uses, but feel free to experiment with your own techniques.
Last modified date: 01/29/2015