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.

Attributes

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

Usage

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

This section is mandatory, unless you use a SCREEN section.

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 m` 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
  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 get a bigger size as 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 will automatically be applied to the parent window node when a form is loaded.

The TEXT attribute can be used to define the title of the window that will display the form. This attribute will automatically be applied to the parent window node when a form is loaded.

The SPACING attribute can be used to give a hint to the front-end to define the gad 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 will automatically be 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.

Identifying layout containers

In most cases you do not need to give a name to a container because it is only used in the form file to define the layout. However, if you want to change some attributes at runtime, you must identify the container. You can give a name to the container by writing an identifier after the container type, for example:
GROUP group1 (TEXT="Customer")
In this example, the group name is 'group1', and it can be used in a program to identify the element:
DEFINE w ui.Window 
DEFINE g om.DomNode 
LET w = ui.Window.getCurrent()
LET g = w.findNode("Group","group1")
CALL g.setAttribute("text","This is the first group")