21. 4GL Statement Glossary : Mode
 
Share this page                  
Mode
Sets the current form to the designated display mode.
Syntax
mode 'modetype'
modetype
Specifies a 4GL name that specifies one of the following display mode types. The modetype must be enclosed in quotes.
fill
Clears all visible fields except for default values specified when the form is edited with VIFRED. In Fill mode, you can enter or change data. Default mode.
update
Allows you to enter or change data but does not clear fields before initialization
read
Allows you to look at but not change the data on the form. Certain letters, when typed in this mode, behaves as if typed in conjunction with the Control key. For example, typing p produces Ctrl-p. Exit activations do not occur if the form is in read mode.
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. Derived fields are not active in Query mode.
Description
The 4GL mode statement typically appears in the initialization section of a frame to set the display mode for the form associated with that frame. The mode statement reinitializes the frame; it breaks the current display and redisplays the current form as if it were being entered from the top in the new mode.
The mode statement also affects the contents of simple fields or the way the table fields behave, depending on the mode you select. It does not reset the mode for table fields. These and other effects of the mode statement are discussed in detail below.
To change a form's mode without reinitializing the form, use the set_forms statement. The set_forms frs(mode) statement is generally better for setting the mode for a form. For more information, see Set_forms.
You can issue both the mode and set_forms statements from anywhere in the frame's 4GL code to change the mode during submenu execution. Upon exiting a submenu, the form reverts to the mode in effect prior to the submenu execution.
Note that if you change to query mode and must retain the values in some of the fields, you can assign the values to local variables, execute the mode query statement, and then assign the hidden values to the original fields and execute the redisplay statement.