Was this helpful?
Display Modes
Display modes affect field behavior, such as the ability to accept data. Form display mode affects the behavior of simple fields. Table field mode is controlled independently of the form mode. These 4GL statements control form modes:
set_forms form (mode = mode)
mode
These 4GL statements control table field modes:
inittable 
set_forms field formname (mode(tablefieldname) =
    modetype)
Form Display Modes
The following are the four basic modes for the form as a whole, controlled by the set_forms statement:
fill
Default mode. Clears all visible fields except for default values specified when the form is edited with VIFRED. In fill mode, the user can enter or change data. Entry and exit activations occur.
Validations, if specified in VIFRED, are performed subject to set_forms frs settings.
update
Allows the user to enter or change data but does not clear fields before initialization. Entry and exit activations occur.
Validations, if specified in VIFRED, are performed subject to set_forms frs settings.
read
Allows the user to look at but not change the data on the form. Certain letters, when typed in this mode, behave as if typed in conjunction with the Control key (for example, p produces CTRL-P). Exit activations do not occur if the form is in read mode.
Validations are not performed.
query
Presents a blank form in which you can enter data to build a query on the database. This mode allows you to enter comparison operators (=, >, <=, and so on) as well as data. A form must be in query mode to allow the use of the qualification function in a database query. Entry activations occur if the form is in query mode.
Only data type checking, not full validation checking, is performed.
By default, a newly displayed form is in fill mode. To change this, use the set_forms statement. In this example, the statement occurs in an initialize statement:
initialize = 
begin 
  set_forms form (mode = 'query'); 
end
Use the set_forms statement in preference to the mode statement when you only want to change the mode. The mode statement is equivalent to reinitializing the frame.
Display Modes for Table Fields
4GL allows you to set table-field modes independently of the form as a whole, with this exception: When the form is in read mode, table fields are also forced to behave as if they are in read mode. When the form is set to some other mode, the table field's true mode behavior is restored.
The four basic modes for table fields are as follows:
fill
Default mode. You can change or add to the displayed data by opening new rows. Validations, if specified in VIFRED, are performed subject to set_forms frs settings.
update
You can change displayed data but not add to it. Validations, if specified in VIFRED, are performed subject to set_forms frs settings.
read
You can look at the data but not modify it or open new rows. Validations are not performed.
query
Allows you to change or add to the displayed data. Can use query operators. Only data type checking, not full validation checking, is performed.
The default display mode for table fields is fill. The inittable statement changes a table field's display mode and clears any associated data. The example below clears the table field "emptbl" and resets it to update mode:
inittable emptbl update;
Inittable erases any values a table field receives from another frame through the parameter list of a callframe statement. Do not use inittable in the initialize block in this case. Instead, place the query that loads the table field in the current frame's initialize block, after inittable. For example:
inittable emptbl read;
emptbl = select * from emp;
Last modified date: 08/14/2024