SIZEPOLICY attribute

The SIZEPOLICY attribute is a sizing directive to display form elements.

Syntax

SIZEPOLICY = { INITIAL |  FIXED | DYNAMIC }

Usage

This attribute defines how the front-ends will compute the size of some form elements in grids.

The default value of SIZEPOLICY is INITIAL.

The SIZEPOLICY applies only to leaf elements, not to containers.

The SIZEPOLICY attribute is ignored for the widgets used in TABLE or TREE columns, because in tables, the size policy is implicitly defined by the cell as fixed (i.e. the size of the column in the form layout).

When the SIZEPOLICY is FIXED, the form elements size is exactly the one defined in layout of the form specification file. The size of the element is computed from the width and height in the form grid and the font used on the front-end side.

When SIZEPOLICY is DYNAMIC, the size of the element grows and shrinks according to the width of the wider item during the life time of the application. This can be used for COMBOBOX or RADIOGROUP fields, when the size of the widget must fit exactly to its content, which can vary during the program execution. With SIZEPOLICY=DYNAMIC, fields of type BUTTON, LABEL, CHECKBOX, IMAGE and RADIOGROUP can shrink and grow all the time, while COMBOBOX fields can only grow.

When SIZEPOLICY is INITIAL, the size is computed the first time the element appears on the screen. Once the widget is displayed, its size is frozen. This is typically used when the size of the element must be fixed but is not known at design time (for instance, when populating a COMBOBOX item list from a database table). This option is also useful when the text of labels is unknown at design time because of Internationalization. With SIZEPOLICY=INITIAL, the behavior differs depending on the form element type. Keep in mind that after the firs the display, the element size will be frozen:

COMBOBOX f001 = customer.city,
        ITEMS=((1,"Paris"),(2,"Madrid"), (3,"London")),
        SIZEPOLICY=DYNAMIC;