SAMPLE attribute
The SAMPLE
attribute defines the text
to be used to compute the width of a form field.
Syntax
SAMPLE = "text"
- text is the sample string that will be used to compute the width of the field.
Usage
By default, form fields are rendered by the client with a size determined by the current font and the number of characters used in the layout grid. The field width is computed so that the largest value can fit in the widget.
Sometimes the default computed width is too wide for the typical
values displayed in the field. For example, numeric fields usually need
less space than alphanumeric fields. If the values are always
smaller, you can use the SAMPLE
attribute to provide
a hint for the front end to compute the best width for that
form field.
When specifying the SAMPLE
attribute,
you do not have to fill the sample string up to the width
of the corresponding field tag: The front-ends will be able to
compute a physical width by applying a ratio to fit the best
visual result. For example, for a sample of 'XY
'
used for a field defined with 10 characters, is equivalent
to specifying a sample of 'XYXYXYXYXY
'.
SAMPLE
attribute is not used, the first 6 cells
are always computed with the pixel width of the 'M
'
character in the current font. Next cells are computed
with the pixel width of the '0' (zero) character. In other words,
the default sample model is 'MMMMMM000000.....
",
reduced to the size of the field tag in the
layout: -123456789-123456789- default sample
[f01 ] MMMM
[f02 ] MMMMMM
[f03 ] MMMMMM0000000000
You
can define a default sample for all fields used in the form, by specifying
a DEFAULT SAMPLE
option in the INSTRUCTIONS
section.
Example
EDIT cid = customer.custid, SAMPLE="0000";
EDIT ccode = customer.ucode, SAMPLE="MMMMMM";
DATEEDIT be01 = customer.created, SAMPLE="00-00-0000";