Summary:
See also: Form Specification Files.
Attribute | Description |
ACCELERATOR | Primary accelerator key for an action default. |
ACCELERATOR2 | Secondary accelerator key for an action default. |
ACCELERATOR3 | Secondary accelerator key for an action default. |
ACTION | Action name to be sent to the program when the item is activated (typically, a button click) |
AUTOSCALE | Forces the item's contents to be scaled according to the available space |
AUTONEXT | Automatically gives the focus to the next field when all data is entered |
BUTTONTEXTHIDDEN | Indicates that the button labels of the element must be hidden. |
CENTURY | Specifies expansion of 2-digit years in DATE and DATETIME fields |
COLOR | Specifies the foreground color of the text displayed by a form item |
COLOR WHERE | Defines a boolean condition based on field values to set the color attribute dynamically |
COMMENT | Specifies a message to display on the Comment line |
DEFAULT | Assigns a default value to a field during data entry |
DEFAULTVIEW | Defines if the default view must be displayed for an action |
DISPLAY LIKE | Assigns attributes from the database schema files |
DOWNSHIFT | Converts to lowercase any uppercase character data |
HEIGHT | Defines explicitly the height of a form element |
HIDDEN | Makes an element invisible |
FORMAT | Formats DECIMAL, SMALLFLOAT, FLOAT, or DATE output |
FONTPITCH | Defines the character font type as fixed or variable |
INCLUDE | Lists a set of acceptable values during data entry |
INVISIBLE | Does not echo characters on the screen during data entry |
IMAGE | Defines the URL of the image resource associated to the form item |
INITIALIZER | Specifies an initialization function for the item |
ITEMS | Defines a list of values to be used by the form item |
JUSTIFY | Specifies the text justification |
NOT NULL | Indicates that the field does not accept NULL values |
NOENTRY | Prevents the user from entering data in the field |
ORIENTATION | Defines the orientation of an element as vertical or horizontal |
PICTURE | Imposes a data-entry format on CHAR or VARCHAR fields |
PIXELWIDTH | Defines the initial width of an image form item in pixels |
PIXELHEIGHT | Defines the initial height of an image form item in pixels |
PROGRAM | Invokes an external program to display TEXT or BYTE values |
QUERYEDITABLE | Allows a combobox field to be editable during a CONSTRUCT |
REQUIRED | Requires the user to supply a value during input instructions |
SAMPLE | Provides the text to be used as a sample to compute the width |
SCROLL | Allows to scroll within the field |
SCROLLBARS | Defines vertical and/or horizontal scrollbars for the form item |
SIZEPOLICY | Indicates sizing hint to display form elements. |
SPACING | Indicates spacing hint to display form elements |
STRETCH | Defines how the widget must resize according to the parent container |
STYLE | Defines a presentation style for the form element. |
TAG | Defines a specific string to identify the form item |
TABINDEX | Defines the tab order for the form item. |
TEXT | Defines the label to be associated to the form item |
TITLE | Defines the title to be associated to the form item |
UPSHIFT | Converts to uppercase any lowercase character data |
UNHIDABLE | Indicates that the column cannot be hidden |
UNHIDABLECOLUMNS | The table does not allow columns to be hidden |
UNMOVABLE | Indicates that the column cannot be moved |
UNMOVABLECOLUMNS | Prevents the user from changing the order of the columns |
UNSIZABLE | Indicates that the column cannot be resized |
UNSIZABLECOLUMNS | The table does not allow columns to be resized |
UNSORTABLE | Indicates that the column cannot be used for sorts |
UNSORTABLECOLUMNS | The table does not allow rows to be sorted |
VALIDATE LIKE | Validates data entry with definitions of the database schema files |
VALUEMIN | Defines the lower limit for widgets like progress bars |
VALUEMAX | Defines the upper limit for widgets like progress bars |
VALUECHECKED | Defines the value to be associated with a checked checkbox |
VALUEUNCHECKED | Defines the value to be associated with an unchecked checkbox |
VERIFY | Requires that data be entered twice when the database is modified |
VERSION | Defines a user version string for an element |
WANTTABS | Forces the field to consume TAB keys |
WANTNORETURNS | Forces the field to reject RETURN keys |
WANTFIXEDPAGESIZE | Forces the table to have a fixed height when the parent window is resized |
WIDTH | Defines explicitly the width of a form element |
Specifies the style to be used by the parent window | |
WORDWRAP | Invokes a multiple-line editor in multiple-segment fields |
CLASS | Specifies the behavior of a field defined with the WIDGET attribute |
CONFIG | Specifies the parameters for the definition of a widget (only used with WIDGET attribute) |
KEY | Defines the label of a key when the field gets the focus |
OPTIONS | Specifies widget definition options |
REVERSE | Causes values in the field to be displayed in reverse video |
WIDGET | Defines the type of widget to be used for presentation |
The ACCELERATOR attribute defines the primary accelerator key of an action default item.
ACCELERATOR = [CONTROL-][SHIFT-][ALT-]key
The ACCELERATOR2 attribute defines the secondary accelerator key of an action default item.
ACCELERATOR2 = [CONTROL-][SHIFT-][ALT-]key
The ACCELERATOR3 attribute defines the third accelerator key of an action default item.
ACCELERATOR3 = [CONTROL-][SHIFT-][ALT-]key
The ACTION attribute defines the name of the action to be sent to the program when the user activates the form item.
ACTION = action-name
01
BUTTONEDIT f001 = customer.state, ACTION = print;
The AUTOSCALE attribute causes the form element contents to automatically scale to the size given to the item.
AUTOSCALE
The AUTONEXT attribute causes the cursor to automatically advance during input to the next field when the current field is full.
AUTONEXT
The CENTURY attribute specifies how to expand abbreviated one- and two-digit year specifications in a DATE and DATETIME field. Expansion is based on this setting (and on the year value from the system clock at runtime).
CENTURY = { "R" | "C" |
"F" | "P" }
The CLASS attribute is used to define the behavior of a field.
CLASS = "identifier"
Class | Description |
KEY | Field is used to trigger a keystroke instead of being a
normal input field. Only supported with special widgets such as buttons, checkboxes and radiobuttons. |
PASSWORD | Field input is masked by replacing normal character echo by stars "*". |
The COLOR attribute defines the foreground color of the text displayed by a form element.
COLOR = color-name
01
EDIT f001 = customer.name, COLOR = RED;
The COLOR WHERE attribute defines a condition to set the foreground color dynamically.
COLOR = color-name [...] WHERE boolexpr
01
EDIT f001 = item.price, COLOR = RED WHERE f001>100;
The CONFIG attribute is used with the WIDGET attribute to define the behavior and decoration of the field.
CONFIG = "parameter [...]"
The COMMENT attribute defines text that can be shown when the element becomes current.
COMMENT = [%]"string"
01
EDIT f001 = customer.name, COMMENT = "The customer name";
The DEFAULT attribute assigns a default value to a field during data entry.
DEFAULT = value
01
EDIT f001 = order.orderdate, DEFAULT = TODAY;
The DEFAULTVIEW attribute defines if the default view (button) must be displayed for an action.
DEFAULTVIEW = [ AUTO | YES | NO ]
The DISPLAY LIKE attribute takes column attributes defined in the database schema files and applies them to a field.
DISPLAY LIKE [table.]column
01
EDIT f001 = FORMONLY.fullname, DISPLAY LIKE customer.custname;
The HIDDEN attribute indicates that the element should not be displayed.
HIDDEN [ = USER ]
By default all elements are visible. You can use the HIDDEN attribute to hide an element, for example a form field or a groupbox. The runtime system handles hidden form fields. If you write an INPUT statement using a hidden field, the field is ignored as if it was declared as NOENTRY. Programs may change the visibility of form fields dynamically with the ui.Form built-in class.
When using the HIDDEN keyword only, the underlying item attribute is set to 1. The value 1 indicates that the element is hidden to the user without the possibility of showing the element, for example with the context menu of table headers. In this hidden mode, the UNHIDABLE attribute is ignored by the front end.
When using HIDDEN=USER, the underlying item attribute is set to 2. The value 2 indicates that the element is hidden by default, but the user can show/hide the element as needed.
01
EDIT f001 = FORMONLY.field1, HIDDEN;02
EDIT col1 = FORMONLY.column1, HIDDEN=USER;
The HEIGHT attribute defines an explicit height of a form element.
HEIGHT = integer [CHARACTERS|LINES|POINTS|PIXELS]
By default, the size of an element is defined in characters and automatically computed by the form compiler according to the size of the form element in the layout.
For tables, the default height is defined by the number of lines used in the table layout. You can overwrite this default by specifying the HEIGHT attribute.
See also: WIDTH.
01
TABLE t1 ( HEIGHT = 20 )
The BUTTONTEXTHIDDEN attribute indicates that the labels of the buttons of this element should not be displayed.
BUTTONTEXTHIDDEN
Assign the DOWNSHIFT attribute to a character field when you want the runtime system to convert uppercase letters entered by the user to lowercase letters, both on the screen and in the corresponding program variable.
DOWNSHIFT
You can use the FORMAT attribute with numeric and date time fields to control the format of output displays.
FORMAT = "format-string"
For DECIMAL, SMALLFLOAT, and FLOAT data types, format-string consists of pound signs (#) that represent digits and a decimal point. For example, "###.##" produces at least three places to the left of the decimal point and exactly two to the right.
If the actual number displayed requires fewer characters than format-string specifies, numbers are right-aligned and padded on the left with blanks.
If necessary to satisfy the format-string specification, the number values are rounded before display.
Character |
Description |
* | Fills with asterisks any position that would otherwise be blank. |
& | Fills with zeros any position that would otherwise be blank. |
# | This does not change any blank positions in the display. |
< | Causes left alignment. |
, (comma) | Defines the position of the comma (not displayed if no digits on left). |
. (period) | Defines the position of the period (only one can be used). |
- | Displays a minus sign for negative numbers. |
+ | Displays a plus sign for positive numbers. |
$ | This is the placeholder for the front specification of DBMONEY or DBFORMAT. |
( | Displayed as left parentheses for negative numbers (accounting parentheses). |
) | Displayed as right parentheses for negative numbers (accounting parentheses). |
For DATE data types, the runtime system recognizes these symbols as special in format-string:
Character |
Description |
dd | Day of the month as a 2-digit integer. |
ddd | Day of the week as a 3-letter abbreviation. |
mm | Month as a 2-digit integer. |
mmm | Month as a 3-letter abbreviation. |
yy | Year, as a 2-digits integer representing the 2 trailing digits. |
yyyy | Year as a 4-digit number |
The form compiler interprets any other characters as literals and displays them wherever you place them within format-string.
These format-string examples and their corresponding display formats for DATE fields display the twenty-third day of September 1999:
FORMAT attribute | Result |
none | 09/23/1999 |
FORMAT = "mm/dd/yy" |
09/23/99 |
FORMAT = "mmm dd, yyyy" |
Sep 23, 1999 |
FORMAT = "yymmdd" |
990923 |
FORMAT = "dd-mm-yy" |
23-09-99 |
FORMAT = "(ddd.) mmm. dd, yyyy" |
(Thu.) Sep. 23, 1999 |
01
EDIT f001 = order.thedate, FORMAT = "mm/dd/yyyy";
This attribute defines the character font type as fixed or variable.
FONTPITCH = {FIXED|VARIABLE}
FIXED
, you force the characters to
have a fixed size.VARIABLE
, you allow the characters to
have a variable size.By default, most front ends use variable width character fonts, but in some cases you might need to use a fixed font. Use this attribute to specify the font pitch for a specific field.
This attribute is used for a container to align its children to the parent container.
GRIDCHILDRENINPARENT
By default, child elements of a container are aligned locally inside the container layout cells. With this attribute, you can force children to be aligned according to the layout cells of the parent container of the container to which you assign this attribute.
This is useful, for example, when you want to align fields across groupboxes defined with Layout Tags inside a GRID:
01
LAYOUT02
GRID03
{04
<G g1 >05
Field1 [f1 ]06
Field2 [f2 ]07
Field3 [f3 ]08
09
<G g2 >10
F4 [f4 ]11
F5 [f5 ]12
13
}14
END15
END16
ATTRIBUTES17
GROUP g1 : GRIDCHILDRENINPARENT;18
GROUP g2 : GRIDCHILDRENINPARENT;19
EDIT f1 = FORMONLY.field1;20
EDIT f2 = FORMONLY.field2;21
EDIT f3 = FORMONLY.field3;22
EDIT f4 = FORMONLY.field4;23
EDIT f5 = FORMONLY.field5;24
END
The INCLUDE attribute specifies acceptable values for a field and causes the runtime system to check the data before accepting an input value.
INCLUDE = ( { NULL | literal [ TO literal
] } [,...] )
01
EDIT f001 = compute.rate, INCLUDE = ( 1 TO 100, 200, NULL);02
EDIT f002 = customer.state, INCLUDE = ( "AL" TO "GA", "IA" TO "WY" );
The INVISIBLE attribute prevents user-entered data from being echoed on the screen during an interactive statement.
INVISIBLE
The IMAGE attribute defines the image file to be associated with the form item.
IMAGE = "name"
This attribute is used, for example, to define the image file containing the icon to be displayed in a button or the picture of an image form item.
The name can be a simple file name, a complete or relative path, or an URL ( Uniform Resource Locator) path to an image server.
You can give a complete path with file extension, but it is recommended that you use a simple name or a relative path without file extension so that the system can automatically search for the image file using the specific extension (bmp, gif, ...).
If the image specification is a simple file name, the file is first sought in the pictures directory on the client workstation; if the file is not found, the front-end automatically sends an image request to the runtime system, in order to search for an image on the application server. The runtime system searches for server-side images by using the FGLIMAGEPATH environment variable.
To simplify deployment, you should use server-side images to centralize all images on the application server.
01
BUTTONEDIT f001 = FORMONLY.field01, IMAGE = "zoom";
The KEY attribute is used to define the labels of keys when the field is made current.
KEY keyname = "label"
01
EDIT f001 = customer.city, KEY F10 = "City list";
The NOT NULL attribute indicates that the field does not accept NULL values.
NOT NULL
This attribute requires only that the field contains a value. If the field contains a default value, the NOT NULL attribute satisfied. To insist on a data entry from the user, combine NOT NULL with the REQUIRED attribute in the field definition, or make sure the corresponding column is defined as REQUIRED in the database schema file.
See also REQUIRED attribute.
01
EDIT f001 = customer.city, NOT NULL;
The NOENTRY attribute prevents data entry in the field during an INPUT or INPUT ARRAY statement.
NOENTRY
01
EDIT f001 = order.totamount, NOENTRY;
The ORIENTATION attribute defines if an element is displayed vertically or horizontally.
ORIENTATION = { VERTICAL | HORIZONTAL }
01
RADIOGROUP f001 = customer.status, ORIENTATION=HORIZONTAL;
The PICTURE attribute specifies a character pattern for data entry in a text field and prevents entry of values that conflict with the specified pattern.
PICTURE = "format-string"
01
EDIT f001 = carinfo.number, PICTURE = "AA####-AA(X)";
The PIXELWIDTH attribute specifies the initial width of an IMAGE form item in number of pixels.
PIXELWIDTH = integer
01
IMAGE i001 = carinfo.picture, PIXELWIDTH = 200;
The PIXELHEIGHT attribute specifies the initial height of an IMAGE form item in a number of pixels.
PIXELHEIGHT = pixels
01
IMAGE i001 = carinfo.picture, PIXELHEIGHT = 200;
The PROGRAM attribute can specify an external application program to work with screen fields of data type TEXT or BYTE.
PROGRAM = "editor"
The QUERYEDITABLE attribute makes a combobox field editable during a CONSTRUCT instruction.
QUERYEDITABLE
The REQUIRED attribute forces the user to enter data in the field during an INPUT or INPUT ARRAY statement.
REQUIRED
This attribute requires only that the user enter a printable character in the field. If the user subsequently erases the entry during the same input, the runtime system considers the REQUIRED attribute satisfied. To insist on a non-null entry, combine REQUIRED with the NOT NULL attribute in the field definition or make sure the corresponding column is defined as NOT NULL in the database schema file.
See also NOT NULL attribute.
On character terminals, the REVERSE attribute displays any value in the field in reverse video (dark characters in a bright field).
REVERSE
The SAMPLE attribute defines a text to be used to compute the width of a form field.
SAMPLE = "text"
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 as 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.
You can define a default sample for all fields used in the form, by specifying a DEFAULT SAMPLE option in the INSTRUCTIONS section.
See also: DEFAULT SAMPLE.
01
EDIT cid = customer.custid, SAMPLE="0000";02
EDIT ccode = customer.ucode, SAMPLE="MMMMMM";03
DATEEDIT be01 = customer.created, SAMPLE="00-00-0000";
The SCROLL attribute can be used to enable horizontal scrolling in the field.
SCROLL
By default the input fields do not allow scrolling in the value with the edit cursor. The maximum input length is defined by the graphical size of the field. For example, if you define an character field in the form with a length of 3 characters, users can only enter a maximum of 3 characters. If you want to let the user input more characters, use this attribute.
The STRETCH attribute specifies how a widget must resize when the parent container is resized.
STRETCH = { NONE | X | Y | BOTH }
This attribute is typically used with form items that can be resized like IMAGE or TEXTEDIT fields. By default such form items have a fixed width and height, but in some cases you may want to force the widget to resize vertically, horizontally, or in both directions.
01
IMAGE i01 = FORMONLY.image01, STRETCH=BOTH;
The TEXT attribute defines the label associated with a form item, for example the text of a checkbox item.
TEXT = [%]"string"
01
CHECKBOX cb01 = FORMONLY.checkbox01, TEXT="OK", VALUECHECKED=1, VALUEUNCHECKED=0;
The TITLE attribute defines the title of a form item, for example the title of a table column.
TITLE = [%]"string"
01
EDIT col1 = FORMONLY.column1, TITLE="Num";
The VALUEMIN attribute defines a lower limit of values displayed in widgets such as progress bars.
VALUEMIN = integer
The VALUEMAX attribute defines a upper limit of values displayed in widgets such as progress bars.
VALUEMAX = integer
The VALUECHECKED attribute defines the value associated with a checkbox item when it is checked.
VALUECHECKED = { value | TRUE | FALSE }
01
CHECKBOX cb01 = FORMONLY.checkbox01, TEXT="OK", VALUECHECKED=TRUE, VALUEUNCHECKED=FALSE;
The VALUEUNCHECKED attribute defines the value associated with a checkbox item when it is not checked.
VALUEUNCHECKED = { value | TRUE | FALSE }
01
CHECKBOX cb01 = FORMONLY.checkbox01, TEXT="OK", VALUECHECKED="Y", VALUEUNCHECKED="N";
Indicates that the element cannot be selected by the user for sorts.
UNSORTABLE
By default, a TABLE container allows the user to sort the columns by a left-click on the column header. Use this attribute to prevent a sort on a specific column.
01
EDIT c01 = item.comment, UNSORTABLE;
Indicates that the columns of the table cannot be selected by the user for sorting.
UNSORTABLECOLUMNS
Same effect as UNSORTABLE, but at the TABLE level, to make all columns not sortable.
01
TABLE t1 ( UNSORTABLECOLUMNS )
Indicates that the element cannot be resized by the user.
UNSIZABLE
By default, a TABLE container allows the user to resize the columns by a drag-click on the column header. Use this attribute to prevent a resize on a specific column.
01
EDIT c01 = item.comment, UNSIZABLE;
Indicates that the columns of the table cannot be resized by the user.
UNSIZABLECOLUMNS
Same effect as UNSIZABLE, but at the TABLE level, to make all columns not resizable.
01
TABLE t1 ( UNSIZABLECOLUMNS )
Indicates that the element cannot be hidden or shown by the user with the context menu.
UNHIDABLE
By default, a TABLE container allows the user to hide the columns by a right-click on the column header. Use this attribute to prevent the user from hiding a specific column.
01
EDIT c01 = item.comment, UNHIDABLE;
Indicates that the columns of the table cannot be hidden or shown by the user with the context menu.
UNHIDABLECOLUMNS
Same effect as UNHIDABLE, but at the TABLE level, to make all columns not hidable.
01
TABLE t1 ( UNHIDABLECOLUMNS )
The UNMOVABLE attribute prevents the user from moving a defined column of a table.
UNMOVABLE
By default, a TABLE container allows the user to move the columns by dragging and dropping the column header. Use this attribute to prevent the user from changing the order of a specific column. Typically, UNMOVABLE is used on at least two columns to prevent the user from changing the order of the input on these columns.
The UNMOVABLECOLUMNS attribute prevents the user from moving columns of a table.
UNMOVABLECOLUMNS
By default, a TABLE container allows the user to move the columns by dragging and dropping the column header. Use this attribute to prevent the user from changing the order of columns.
Assign the UPSHIFT attribute to a character field when you want the runtime system to convert lowercase letters entered by the user to uppercase letters, both on the screen and in the corresponding program variable.
UPSHIFT
01
EDIT f001 = FORMONLY.thetitle, UPSHIFT;
The VALIDATE LIKE attribute instructs the runtime system to validate the data entered in the field by using the validation rules defined in the database schema file for the column associated with the field.
VALIDATE LIKE [table.]column
01
EDIT f001 = FORMONLY.fullname, VALIDATE LIKE customer.custname;
The INITIALIZER attribute allows you to specify an initialization function that will be automatically called by the runtime system to set up the form item.
INITIALIZER = function
The initialization function must exist in the program using the form file and must be defined with a parameter of the type of the built-in class corresponding to the form item.
In the form file:
01
COMBOBOX f001 = FORMONLY.state, INITIALIZER = initcombo, TAG = "state";
Program code:
01
FUNCTION initcombo(cb)02
DEFINE cb ui.ComboBox03
IF cb.getTag()="state" THEN04
CALL cb.addItem(101,"Alabama")05
CALL cb.addItem(102,"Nevada")06
CALL cb.addItem(103,"Florida")07
CALL cb.addItem(104,"California")08
END IF09
END FUNCTION
The ITEMS attribute defines a list of possible values that can be used by the form item.
ITEMS = value-list
where value-list is:
( { value | value-list } [,...]
)
The list must be delimited by parentheses, and each element of the list can be a simple literal value or a pair of literal values delimited by parentheses.
The following example defines a list of simple values:
ITEMS = ("Paris", "London", "New York")
The next example defines a list of pairs:
ITEMS = ((1,"Paris"),(2,"London"),(3,"New York"))
This attribute can be used, for example, to define the list of a COMBOBOX form item:
01
COMBOBOX cb01 = FORMONLY.combobox01, ITEMS = ((1,"Paris"),(2,"London"),(3,"New York"));
In this case, the first value of a pair (1,2,3) defines the data values of the form field and the second value of a pair ("Paris", "London", "New York") defines the value to be displayed in the selection list.
When used in a RADIOGROUP form item, this attribute defines the list of radio buttons:
01
RADIOGROUP rg01 = FORMONLY.radiogroup01, ITEMS = ((1,"Paris"),(2,"London"),(3,"New York"));
In this case, the first value of a pair (1,2,3) defines the data values of the form field and the second value of a pair ("Paris", "London", "New York") defines the value to be displayed as the radio button label.
You can specify item labels with Localized Strings, but this is only possible when you specify a key and a label:
ITEMS = ((1,%"item1"),(2,%"item2"),(3,%"item3"))
The JUSTIFY attribute defines text justification.
JUSTIFY = { LEFT | CENTER | RIGHT }
Default text justification depends on the dialog type, the field data type and the FORMAT attribute. For example, a numeric field value is right aligned, while a string field is left aligned. The type of dialog also defines the default justification. In a CONSTRUCT, all input fields are left aligned, for search criteria input.
With the JUSTIFY attribute, you define the display text justification of a field, as LEFT, CENTER or RIGHT. This attribute is ignored for input: Only the default text justification rule applies when a field has the focus.
The JUSTIFY attribute can only be used for widgets displaying a value as text, like a LABEL, EDIT or BUTTONEDIT.
01
LABEL t01 : TEXT="Hello!", JUSTIFY=RIGHT;02
EDIT f01 = order.value, JUSTIFY=CENTER;
The SCROLLBARS attribute can be used to specify scrollbars for a form item.
SCROLLBARS = { NONE | VERTICAL | HORIZONTAL |
BOTH }
This attribute defines scrollbars for the form item, such as a TEXTEDIT.
01
TEXTEDIT f001 = customer.fname, SCROLLBARS=BOTH;
The SIZEPOLICY attribute is a sizing directive to display form elements.
SIZEPOLICY = { INITIAL | FIXED | DYNAMIC }
This attribute defines the initial size of some form elements. The default value of SIZEPOLICY is INITIAL.
When the SIZEPOLICY is FIXED, the form elements size is exactly the one defined in the Form Specification File. The width of the element is computed from the defined width and the font used.
For some elements such as COMBOBOX or RADIOGROUP, you may want the size of the widget to fit exactly to its content: When SIZEPOLICY is DYNAMIC, the width of the element grows and shrinks according to the width of the wider item.
When a form element is created from a database (for instance populating a COMBOBOX item list), the width of each element is not known when designing the form. When SIZEPOLICY is INITIAL, the width is computed to display the element correctly the first time it appears on the screen. Once it is displayed, its width is frozen. This behavior is also very useful when using Internationalization.
When SIZEPOLICY is INITIAL, the client behaves differently depending on the form element type:
The following table shows the effect of the SIZEPOLICY attribute according to the type of form item:
Item Type | INITIAL | FIXED | DYNAMIC |
EDIT | same as FIXED | fixed | no effect |
BUTTONEDIT | same as FIXED | fixed | no effect |
TEXTEDIT | same as FIXED | fixed | no effect |
DATEEDIT | can shrink | fixed | no effect |
COMBOBOX | can grow | fixed | same as INITIAL |
BUTTON | can grow | fixed | can shrink and grow |
LABEL | can shrink and grow | fixed | can shrink and grow |
RADIOGROUP | can shrink and grow | fixed | can shrink and grow |
CHECKBOX | can shrink and grow | fixed | can shrink and grow |
IMAGE | same as FIXED | fixed (uses IMAGE attributes) | can shrink and grow |
Keep in mind that INITIAL always corresponds to the first content, DYNAMIC to the content at anytime.
01
COMBOBOX f001 = customer.city, ITEMS=((1,"Paris"),(2,"Madrid"),(3,"London")), SIZEPOLICY=DYNAMIC;
The SPACING attribute is a spacing directive to display form elements.
SPACING = { NORMAL | COMPACT }
This attribute defines the global distance between two neighboring form elements. By default, forms are displayed with NORMAL spacing. In this mode the front end displays form elements consistent with the desktop spacing, which is, for example, 6 and 10 pixels on Microsoft Windows platforms. Some overcrowded forms may need to be displayed with less space between elements, to let them fit to the screen. In this case you can use the COMPACT mode.
01
LAYOUT ( SPACING=COMPACT )
The STYLE attribute is used to specify a presentation style for a form element.
STYLE = "string"
This attribute specifies a presentation style to be applied to a form element. The presentation style can define decoration attributes such as a background color, a font type, etc.
The TAG attribute can be used to identify the form item with a specific string.
TAG = "tag-string"
This attribute is used to identify form items with a specific string. It can be queried in the program to perform specific processing.
You are free to use this attribute as you need. For example, you can define a numeric identifier for each field in the form in order to show context help, or group fields for specific input verification.
If you need to handle multiple data, you can format the text, for example, by using a pipe separator.
01
EDIT f001 = customer.fname, TAG = "name";02
EDIT f002 = customer.lname, TAG = "name|optional";
The TABINDEX attribute defines the tab order for a form item.
TABINDEX = integer
This attribute can be used to define the order in which the form items are selected as the user "tabs" from field to field when the program is using the form field order option.
It can also be used to define which field must get the focus when a folder page is selected.
By default, form items get a tab index according to the order in which they appear in the LAYOUT section.
01
EDIT f001 = customer.fname, TABINDEX = 1;02
EDIT f002 = customer.lname, TABINDEX = 2;
The VERIFY attribute requires users to enter data in the field twice to reduce the probability of erroneous data entry.
VERIFY
The VERSION attribute is used to specify a user version string for an element.
VERSION = { "string" | TIMESTAMP }
This attribute specifies a version string to distinguish different versions of a form element. You can specify an explicit version string or use the TIMESTAMP keyword to force the form compiler to write a timestamp string into the 42f file.
Typical usage is to specify a version of the form to indicate if the form content has changed. This attribute is used by the front-end to distinguish different form versions and to avoid reloading window/form settings into a new version of a form.
01
LAYOUT ( TEXT="Orders", VERSION = "1.23" )
The OPTION attribute specifies widget options for the field.
OPTIONS = "option [...]"
-nolist
(to indicate that the
column should appear as an independent field).The WANTTABS attribute forces a text field to insert TAB characters in the text when the user presses the TAB key.
WANTTABS
By default, text fields like TEXTEDIT do not insert a TAB character in the text when the user presses the TAB key, since the TAB key is used to move to the next field. You can force the field to consume TAB keys with this attribute.
The WANTNORETURNS attribute forces a text field to reject NewLine characters when the user presses the RETURN key.
WANTNORETURNS
By default, text fields like TEXTEDIT insert a NewLine (ASCII 10) character in the text when the user presses the RETURN key. As the RETURN key is used to validate the dialog, you can force the field to reject RETURN keys with this attribute.
The WANTFIXEDPAGESIZE attribute gives a fixed height to a TABLE container.
WANTFIXEDPAGESIZE
By default, the height of a TABLE container is resizable. Use this attribute to freeze the number of rows to the number of screen lines defined by the form file.
The WIDTH attribute defines an explicit width of a form element.
WIDTH = integer [CHARACTERS|COLUMNS|POINTS|PIXELS]
By default, the size of an element is defined in characters and automatically computed by the form compiler according to the size of the form element in the layout.
For tables, the default width is defined by the columns used in the table layout. You can overwrite this default by specifying the WIDTH attribute. You typically give a number of columns as shown in the example below. This allows you to use tables with a large number of columns, but a small initial width.
See also: HEIGHT.
01
TABLE t1 ( WIDTH = 5 COLUMNS )
The WIDGET attribute specifies the type of graphical widget to be used for the field.
WIDGET = "identifier"
Symbol | Effect | Other attributes |
Canvas | The field is used as a drawing area. Field must be declared as FORMONLY field. |
None. |
BUTTON | The field is presented as a button widget with a label. | CONFIG: The unique parameter defines
the key to be sent when the user clicks on the button. Button text is
defined in configuration files or from the program with a DISPLAY
TO instruction. For example: CONFIG = "Control-z" |
BMP | The field is presented as a button with an image. | CONFIG: First parameter defines
the image file to be displayed, second parameter defines the key to be
sent when the user clicks on the button. For example: CONFIG = "smiley.bmp F11" Important warning: Image files are not centralized on the machine where the program is executed; image files must be present on the Workstation. See front end specific documentation for more details. |
CHECK | The field is presented as a checkbox widget.
It can be used with the CLASS attribute to change the behavior of the widget. |
CONFIG: First and second
parameters define the values corresponding respectively to the state
"Checked" / "Unchecked" of the check box, while the
third parameter defines the label of the checkbox. For example: CONFIG = "Y N Confirmation" If the CLASS attribute is used with the "KEY" value, the first and second parameters defines the keys to be sent respectively when the checkbox is "Checked" / "Unchecked", and the third parameter defines the label of the checkbox as with normal checkbox usage. For example: CLASS="KEY",CONFIG="F11 F12 Confirmation" |
COMBO | The field is presented as a combobox widget.
It can be used with the CLASS attribute to change the behavior of the widget. |
INCLUDE: This attribute defines
the list of acceptable values that will be displayed in the combobox
list. For example: INCLUDE = ("Paris", "London", "Madrid") Important warning: The INCLUDE attribute cannot hold value range definitions, because all items must be explicitly listed to be added to the combobox list. The following example is not supported: INCLUDE = ( 1 TO 10 ) |
FIELD_BMP | The field is presented as a normal editbox, plus a button on the right. | CONFIG: The first parameter defines
the image file to be displayed in the button;
the second parameter defines the key to be sent when the user clicks
on the button. For example: CONFIG = "combo.bmp Control-z" |
LABEL | The field is presented as a simple label, a read-only text. | None. |
RADIO | The field is presented as a radiogroup widget. | CONFIG: Parameter pairs define
respectively the value and the label corresponding to one radio button. For example: CONFIG = "AA First BB Second CC Third" If the CLASS attribute is used with the value "KEY", the first element of each pairs represents the key to be sent when the user selects a radio button. For example: CLASS="KEY", CONFIG="F11 First F12 Second F13 Third" |
The following list of widgets can be enabled or disabled from programs with a DISPLAY TO instruction:
If you display an exclamation mark in such fields, the button is enabled, but if you display a star (*), it is disabled:
01
DISPLAY "*" TO button1 # disables the button02
DISPLAY "!" TO button1 # enables the button
Text buttons (WIDGET="BUTTON") can be changed from programs with the DISPLAY TO instruction:
01
DISPLAY "Click me" TO button1 # Sets text and enables the button
Image buttons (WIDGET="BMP") can be changed from programs with the DISPLAY TO instruction:
01
DISPLAY "smiley.bmp" TO button1 # Sets image and enables the button
Warning: Image files are not centralized on the machine where the program is executed; image files must be present on the Workstation. See front end specific documentation for more details.
The text if label fields (WIDGET="LABEL") can be changed from programs with the DISPLAY TO instruction:
01
DISPLAY "Firstname" TO l_firstname # Sets text of the label field
The fields declared with the WIDGET="Canvas" attribute can be used by the program as drawing areas. Canvas fields must be defined in the LAYOUT section. A set of drawing functions are provided to fill CANVAS fields with graphical elements.
The WINDOWSTYLE attribute defines the style to be used by the parent window of a form.
WINDOWSTYLE = "string"
The WINDOWSTYLE attribute can be used to specify the style of the parent window that will hold the form. This attribute is specific to the LAYOUT element. Do not confuse with the STYLE attribute, which is used to specify decoration style of the form elements.
When a form is loaded by the OPEN WINDOW or DISPLAY FORM instructions, the runtime system assigns automatically the WINDOWSTYLE to the 'style' attribute of the parent window element.
See also: STYLE, Windows and Forms.
01
LAYOUT ( STYLE="BigFont", WINDOWSTYLE="dialog" )
The WORDWRAP attribute enables a multiple-line editor.
WORDWRAP [ { COMPRESS | NONCOMPRESS } ]
The maximum number of bytes a user can enter is the width of the form-field multiplied by the height of the form-field. Blank characters may be intentional blanks or fill blanks. Intentional blanks are initially stored in the target variable ore entered by the user. Fill blanks are inserted at the end of a line by the editor when the new-line or a word-alignment forces a line-break. It is not possible to set the cursor at a fill blank. Intentional blanks are always displayed (even on the beginning of a line; the word-wrapping method used in reports with PRINT WORDWRAP works differently).
When entering characters with Japanese locales, special characters are prohibited from being the first or the last character on a line. If the last character is prohibited from ending a line, this character is wrapped down to the next line. If the first character is prohibited from beginning a line, the preceding character will also wrap down to the next line. This method is called kinsoku. The test for prohibited characters will be done only once for the first and the last character on each line.
Word-wrapping is disabled on the last row of a WORDWRAP field. The last word on the last row may by truncated. The WORDWRAP COMPRESS attribute instructs the editor to remove fill blanks before assigning the field-buffer to the target variable. The WORDWRAP NONCOMPRESS attribute instructs the editor to store fill blanks to the target variable. The WORDWRAP and WORDWRAP NONCOMPRESS attributes are equivalent.