TableWrapLayout
TableWrapLayout is a grid-based layout very similar to SWT's versatile
GridLayout. It differs from GridLayout in that it uses a layout algorithm that
works more like HTML tables. It tries to respect the provided client area width
and grows vertically to compensate.
There are many similarities between GridLayout and
TableWrapLayout. Both organize children in grids. Both have layout data that
instructs the layout how to treat each control. Both can accept hints on which
control should grab excess space, etc.
However, they fundamentally differ in the approach to the
layout. TableWrapLayout
starts with columns. It computes minimal,
preferred and maximum widths of each column and uses this information to assign
excess space. It also tries to be fair when dividing space across columns so
that there is no excess wrapping of some controls.
It is possible to mix GridLayout
and
TableWrapLayout
but the branch where GridLayout
is used is
the one where wrapping stops. This is quite acceptable if you don't want it to
wrap (if the composite contains controls that cannot wrap anyway, like text,
buttons, trees etc.). However, you should have an unbroken path of TableWrapLayouts
from the form body to each text control that needs to wrap.