Item tags

Item tags define the position and size in a grid-based container.

Basics

An item tag defines the position and size of a simple form item, as leaf nodes in the structure of a form definition. Item tags are used to define form input fields, as well as other form items such as static images and static labels.

Item tags as used in a grid-area of a GRID or SCROLLGRID container, and are also used to define TABLE and TREE columns.

Syntax

Single item tag:
[identifier    ]
Multiple item tags separated by a pipe:
[identifier-1  |identifier-2 ... ]
Item tag with hyphen-minus to specify the real width:
[identifier   -    ]
  1. identifier references a form item definition in the ATTRIBUTES section.
  2. The - hyphen-minus defines the real width of the element.
  3. The | pipe can be used as item tag separator, that will occupy a single form grid cell.

Usage

An item tag is delimited by square brackets ([]) or pipes (|) and contains an identifier used to reference the description of the form item in the ATTRIBUTES section. In this example, the identifier of the form item is "f01", and the form item type is BUTTONEDIT:

LAYOUT
GRID
{
   ...
   [f01            ]
   ...
}
END
...
ATTRIBUTES
BUTTONEDIT f01 = customer.cust_name, ACTION=zoom;
...
Each item tag must be indicated by left and right delimiters to show the length of the item and its position within the container layout. Both delimiters must appear on the same line. You must use left and right square brackets ([]) to delimit item tags. The number of characters and the delimiters define the width of the region to be used by the item:
GRID
{
  Name:  [f001                               ]
}
END
The form item position starts after the [ open square bracket and the length is defined by the number of characters between the square brackets. The following example defines a form item starting at position 3, with a length of 2:
GRID
{
1234567890
 [f1]
}
END

By default, the real width of the form item is defined by the number of characters used between the tag delimiters.

For some special items like BUTTONEDIT, COMBOBOX and DATEEDIT, the width of the field is adjusted to include the button. The form compiler computes the width as: width=nbchars-2 if nbchars>2:
GRID
{
 1234567
[f1     ]  -- this EDIT gets a width of 7
[f2     ]  -- this BUTTONEDIT gets a width of 5 (7-2)
}
END
If the default width generated by the form compiler does not fit, the - hyphen-minus symbol can be used to define the real width of the item. In this example, the form item occupies 7 grid cells, but gets a real width of 5 (this means for an EDIT field, you are able to enter 5 characters):
GRID
{
 1234567
[f1   - ]
}
END
To make two items appear directly next to each other, you can use the pipe symbol (|) to indicate the end of the first item and the beginning of the second item:
GRID
{
  Info:  [f001    |f002             |f003    ]
}
END
If you need the form to support items with a specific height (more than one line), you can specify multiple-segment item tags that occupy several lines of a grid-area. To create a multiple-segment item, repeat the item tag delimiters without the item identifier on successive lines:
GRID
{
  Multi-segment: [f001                               ]
                 [                                   ]
                 [                                   ]
                 [                                   ]
                 [                                   ]
}
END

The notation applies to the new LAYOUT section only. For backward compatibility (when using a SCREEN section), multiple-segment items can be specified by repeating the identifier in sub-lines.

If the same item tag (with the same identifier) appears more than once in the layout, it defines a column of a screen array. Repeated item tags can be used to define:

Example using a GRID container:

LAYOUT
GRID
{
    [f001          ] [f002          ]  [f003          ]
    [f001          ] [f002          ]  [f003          ]
    [f001          ] [f002          ]  [f003          ]
    [f001          ] [f002          ]  [f003          ]
}
END
END
ATTRIBUTES
f001 = FORMONLY.field1;
f002 = FORMONLY.field2;
f003 = FORMONLY.field3;
END
INSTRUCTIONS
SCREEN RECORD my_screen_array (FORMONLY.*);
END
Static field sets can be repeated with some x or y position offset, as long as all are properly arranged:
GRID
{
    [f001          ]  [f002          ]
        [f003                                          ]
    [f001          ]  [f002          ]
        [f003                                          ]
    [f001          ]  [f002          ]
        [f003                                          ]
    [f001          ]  [f002          ]
        [f003                                          ]
}
END
Item tags defining TABLE columns:
TABLE
{
[c1    |c2                |c3         ]
[c1    |c2                |c3         ]
[c1    |c2                |c3         ]
}
END
In rare use cases, item tags can be arranged horizontally in a GRID container:
GRID
{
[f001  ] [f001  ] [f001  ] [f001  ] [f001  ] [f001  ]
[f002  ] [f002  ] [f002  ] [f002  ] [f002  ] [f002  ]
[f003  ] [f003  ] [f003  ] [f003  ] [f003  ] [f003  ]
}
END