Fields can now resize if their container (see
Panels below) changes size. This is managed by allowing you to
anchor all fields to two or more edges of their
container.
The default anchor points for all pre-existing
fields, and all new fields, are ‘top & left’. If
you resize the container, they remain as they
are.
If you select ‘right’ as well, the
field will get wider and narrower as the container does. If you
select ‘bottom’ as well, the field will get taller and
shorter as the container does. Select both, and it does
both.
If you select only ‘right & top’,
the field will move to the right as the form gets wider. Likewise
with ‘right & bottom’ it will move with the bottom
right corner.
To summarise the functionality of the anchor
points:
-
Two
anchor points must be selected that are non-opposing (ie one
vertical, one horizontal).
-
Additional anchor points may be selected, up to
all four.
-
The
field will track any non-opposed anchor point
-
If an
opposite anchor point is selected, the field will track both, and
thus change size.
This can give you functionality as demonstrated
in our Demo Anchors Solution. In this case, the corner fields were
anchored to their corner, and the in between fields to their
nearest edges and the two ‘side’ edges. The centre
field is anchored to all edges:
And when the form is
expanded:
And when it is contracted:
You should be aware that fields may become too
small to be usable, however:
And in extreme cases can hide each
other:
In another invalid case, we made all the top
fields anchored like the centre field. As you can see, it causes
field to overlap. You need to be aware of this and make sure it
does not occur.
The general rule is that only one field of any
set lined up in any one dimension (ie only one field in a
‘row’ or ‘column’ in this case) can be set
to expand in that particular dimension. The rest must be set to
move to give it space to expand. This ‘rule’ allows
only one field to be anchored to all edges.
It must also be noted that only fields that do
not have a fixed height, such as memo, grid and frame fields, can
expand vertically. If fixed height fields such as text fields are
anchored to top and bottom, they do not expand
vertically.
It can be a bit awkward to work out at design
time at first, but very quickly becomes second-nature. It is very
useful that you can adjust the size of the form at design time, and
the fields behave as they will at run time: