Contents |
In most cases form widgets should be conveniently arranged and aligned. Positioning, aligning and resizing widgets by hand is not easy and these parameters are not adjusted when the user resizes the form. In fact the situation is even worse because you cannot assume a given form requires a given space because users have different font sizes and display resolutions.
Using special tool called widget layouts can help to automatically lay out the form widgets. Widget layout is an action of grouping two or more widgets so these are well positioned and have appropriate sizes.
Using layout in a form improves alignment. Moreover, its space is better used. Text fields are closer to each other, spacing is constant.
Instead of setting a fixed size for your widgets, in Kexi you can choose between various widget's size policies. A size policy is a flexible strategy for controlling how a widget is stretched (or shrunk) depending on other neighbouring widgets and space available within the form.
After putting widgets into a layout, typically each widget gets a proportional () size policy. These widgets will be automatically resized with preferred settings, depending on their type and size of the entire layout itself. For example, three buttons put into the horizontal layout will be resized to fit their visible text.
For each widget inserted into the form, there are settings for size policy available in the Property Editor. The settings are presented as a group of properties called Size Policy.
This group of properties contains:
The following values are available in the drop down list for Horizontal Size Policy and Vertical Size Policy properties visible in the Property Editor:
Different widget types have various default size policies; for example, button widgets have default size policy set to (in both directions), while text field widgets have vertical size policy set to .
The most frequently used size policies are , and .
The Vertical Stretch and Horizontal Stretch properties accept integer values greater than or equal to 0. These properties allow to fine-tune the behavior of size policies. The default value for the properties is 0. A higher value of the stretch means that the widget will be expanded more than widgets for which a lower stretch value is set.