Kexi/Håndbog/Byg en enkel database/Design af formularer/Layout af kontroller

From KDE UserBase Wiki
Revision as of 06:55, 21 April 2012 by Claus chr (talk | contribs) (Importing a new version from external source)
Other languages:


Størrelsespolitikker for kontroller

I stedet for at give dine kontroller en fast størrelse kan du i Kexi vælge mellem forskellige størrelsespolitikker for kontroller. En størrelsespolitik er en fleksibel måde at kontrollere, hvordan en kontrol bliver strukket (eller sammenpresset) afhængigt af kontrollerne omkring den og hvor meget plads der er tilgængelig i formularen.

Når en kontrol placeres i formularen, så får den typisk en proportionel størrelsespolitik (Foretrukken). Sådanne kontroller vil automatisk få tilpasset deres størrelse ud fra en foretrukken størrelse, som afhænger af deres type og af hele formularens størrelse. For eksempel vil tre knapper placeret ved siden af hinanden blive tilpasset, sådan at deres tekst kan ses.

Enhver kontrol, som placeres i formularen har indstillinger for størrelsespolitikken i feltet Egenskabseditor. Indstillingerne findes i en gruppe af egenskaber kaldet Størrelsespolitik.

Denne gruppe egenskaber indeholder:

Politik for vandret størrelse
definerer kontrollens vandrette størrelse,
Politik for lodret størrelse
definerer kontrollens lodrette størrelse,
Vandret udstrækning
definerer styrken af den vandrette udstrækning
Lodret udstrækning
definerer styrken af den lodrette udstrækning
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.