Kexi/Handbook/Building Simple Databases/Designing Forms/Widget layouts/da: Difference between revisions

From KDE UserBase Wiki
(Importing a new version from external source)
(Importing a new version from external source)
Line 96: Line 96:
{{Prevnext2
{{Prevnext2
|prevpage=Special:MyLanguage/Kexi/Handbook/Building_Simple_Databases/Designing_Forms/Actions
|prevpage=Special:MyLanguage/Kexi/Handbook/Building_Simple_Databases/Designing_Forms/Actions
|prevtext=Actions
|prevtext=Handlinger
|nextpage=Special:MyLanguage/Kexi/Handbook/Building_Simple_Databases/Designing_Forms/Setting_widgets_size_and_position_by_hand
|nextpage=Special:MyLanguage/Kexi/Handbook/Building_Simple_Databases/Designing_Forms/Setting_widgets_size_and_position_by_hand
|nexttext=Setting widgets size and position by hand
|nexttext=Manuel indstilling af kontrollers størrelse og position
|index=Special:MyLanguage/Kexi/Handbook|indextext=Back to menu
|index=Special:MyLanguage/Kexi/Handbook|indextext=Indholdsfortegnelse
}}
}}


[[Category:Kexi]]
[[Category:Kexi]]
[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 18:42, 10 April 2012

Other languages:

Layout af kontroller

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.


Size policies for widgets within a layout

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 (Preferred) 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:

Horizontal Size Policy
defining horizontal size of the widget,
Vertical Size Policy
defining vertical size of the widget,
Horizontal Stretch
defining strength of activity of the Horizontal Size Policy,
Vertical Stretch
defining strength of activity of the Vertical Size Policy
Values of size policies

The following values are available in the drop down list for Horizontal Size Policy and Vertical Size Policy properties visible in the Property Editor:

Fixed
this value means that the widget cannot be automatically resized; it should maintain the constant size defined at design time (width or height),
Minimum
this value means that the original size of the widget is set as minimal allowed, it is sufficient and there is no need for expanding the widget, but the widget will be expanded if needed. This type of policy can be used to force the widget to be expanded to the whole width or height, especially if you set a stretch value greater than 0.
Maximum
this value means that the original size of the widget is set as maximum allowed and can be decreased without breaking the widget's usability and readability if other widgets need more space,
Preferred
this value means that the original size of the widget is the best and preferred; the widget can be shrunk or expanded however and it will stay readable,
Expanding
this value means that the original size of the widget is reasonable but the widget can be also shrunk; it can be expanded as well to take as much space as possible,
Minimum Expanding
this value means that the original size of the widget is allowed; it can be expanded to take as much space as possible,
Ignored
this value means that the original size of the widget is ignored; the widget can be expanded to take as much space as possible but other widgets usually will not allow for that

Different widget types have various default size policies; for example, button widgets have default size policy set to Minimum (in both directions), while text field widgets have vertical size policy set to Fixed.

The most frequently used size policies are Preferred, Minimum and Maximum.

Vertical and horizontal stretch

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.