LAYOUT section

The LAYOUT section defines the graphical alignment of the form by using a tree of layout containers.

Syntax

LAYOUT [ ( layout-attribute [,...] ) ]
  root-container
     child-container
     [...] 
  END
[END]
  1. layout-attribute is an attribute for the whole form.
  2. root-container is the first container that holds child-containers.

Form attributes

IMAGE, MINHEIGHT, MINWIDTH, STRETCH, STYLE, TEXT, TAG, VERSION, WINDOWSTYLE.

Style attributes (form)

Common: backgroundColor, border, fontFamily, fontSize, fontStyle, fontWeight, textColor, textDecoration.

See also: Window style attributes, UserInterface style attributes.

Can hold

FORM, VBOX, HBOX, GROUP, FOLDER, GRID, SCROLLGRID, TABLE, TREE.

Usage

The LAYOUT section defines a tree of layout containers such as VBOX, HBOX, GRID, TABLE.

The LAYOUT section must appear in the sequence described in form file structure.

This section is mandatory, unless you use a SCREEN section. However, the purpose of the SCREEN section is to design forms for the TUI mode.

Indentation is supported in the LAYOUT section.

The END keyword is optional.

The layout tree of the form is defined by associating layout containers. Different kinds of layout containers are provided, each of them having a specific role. Some containers such as VBOX, HBOX and FOLDER can hold children containers, while others such as GRID and TABLE define a screen area. Containers using a screen area define a formatted region containing static text labels, item tags and layout tags. External form files can be included in the current layout with the FORM clause.

LAYOUT (VERSION="12", STYLE="regular")
  VBOX
    GRID grid1
      grid-area
    END
    GROUP group1
      HBOX
        GRID grid2
          grid-area
        END
        TABLE table1
          table-area
        END
      END
    END
  END 
END
The definition would result in a layout tree that looks like this:
-- VBOX
   |
   +-- GRID grid1
   |
   +-- GROUP group1
       |
       +-- HBOX
           |
           +-- GRID grid2
           |
           +-- TABLE table1
The layout section can also contain a simple GRID container (equivalent to a V3 SCREEN definition):
LAYOUT
  GRID
    grid-area
  END 
END

Description of LAYOUT attributes

The VERSION attribute can be used to specify a version for the form. This allows you to indicate that the form content has changed. Typically used to avoid having the front-end reload the saved window settings.

The MINHEIGHT, MINWIDTH attributes can be used to specify a minimum width and height for the form. You typically use these attributes to force the form to have a bigger size than the default when it is first rendered. If the front-end stores window sizes, these attributes will only be significant the first time the form is opened, or each time the VERSION attribute is changed.

The IMAGE attribute can be used to define the icon of the window that will display the form. This attribute is automatically applied to the parent window node when a form is loaded. The window icon can be changed dynamically with the ui.Window.setImage) method.

The TEXT attribute can be used to define the title of the window that will display the form. This attribute is automatically applied to the parent window node when a form is loaded. The window title can be changed dynamically with the ui.Window.setText() method.

The SPACING attribute can be used to give a hint to the front-end to define the gap between form elements.

The STYLE attribute defines the presentation style for form elements, you can for example define a font property for all form elements.

With the WINDOWSTYLE attribute, you can define the window type and decoration. This attribute is automatically applied to the parent window when a form is loaded. For backward compatibility, the STYLE attribute is used as the default WINDOWSTYLE if this attribute is not used.