Avoid relative attachments with
text-based objects that must be aligned on a row/column boundary.
Usually the desired placement of a component after honoring a relative attachment
does not exactly align on a row/column boundary,
which necessitates a shift of the component to attain the required alignment. This
situation can create odd visual effects, and it significantly increases the chance
that textual objects will overlap. If you feel you must use relative attachments with
text-based objects, be sure to leave space around each component to allow for shifting
without creating an overlap situation.
A related problem occurs when a container contains character-aligned objects (widgets)
and the container is relatively attached. The container is not character-cell aligned,
and when the master component is resized, the widgets often shift within the container.
You can avoid this shifting by creating a dummy character-cell-aligned component (for
example, a one-character text
field that is protected and nondisplayable). Attach this dummy component to the master
component relatively, and then attach the container to the dummy component absolutely.
Make sure the absolute attachment is short so that the resulting location of the container
is as close to relatively correct as possible.
When the master component is resized, the dummy component will be positioned relatively,
and then it will align
to a character-cell boundary. Then, the absolute attachment between it and the container
will be honored. No shifting will occur within the container either since the net
movement of the container is guaranteed to be an integral number of character cells.
This guarantee is possible because the master component is always an integral number
of character cells in size and the dummy component is always character-cell aligned.