
buf[0] = '0';
else
buf[0] = 'X';
buf[1] = 0;
str = XmStringCreateLocalized (buf);
XtVaSetValues (w, XmNlabelString, str, NULL);
XmStringFree (str);
}
The output of this program is shown in the figure.
Output of tictactoe.c
As you can see, the children of the Form are equally sized because their attachment positions are segmented equally.
If the user resizes the Form, all of the children maintain their relationship to one another. The PushButtons simply
grow or shrink to fill the form.
One common use of positional attachments is to lay out a number of widgets that need to be of equal size and equal
spacing. For example, you might use this technique to arrange the buttons in the action area of a dialog. Chapter 7,
Custom Dialogs, provides a detailed discussion of how to arrange buttons in this manner.
There may be situations where you would like to attach widgets to horizontal positions that do not match up with how
you'd like to attach their vertical positions. Since the fraction base cannot be set differently for the horizontal and
vertical orientations, you have to use the least common multiple as the fraction base value. For example, say you want
to position the tops and bottoms of all of your widgets to the 2nd and 4th positions, as if the Form were segmented
vertically into 5 parts. But, you also want to position the left and right edges of those same widgets to the 3rd, 5th, 7th,
and ...