21. 4GL Statement Glossary : Set_forms : Set_forms Formobject
 
Share this page                  
Set_forms Formobject
In this discussion, set_forms formobject refers to the following variant of the set_forms statement:
set_forms objecttype (set_forms constant)
The objecttype accepted in each case varies, but can be one of the following form components: column, field, form, menu, and row.
The set_forms_constant can be one of the following:
active
Enables or disables the specified menu item
change
Sets the change value of a form, field, or row and column
color
Sets color on terminals with color
(display attributes)
Turns the specified display attribute on or off.
The display variable refers to any one of the set_forms constants, such as blink or underline, that control display characteristics for the named formobject.
mode
Sets the mode for the current form
rename
Renames the specified menu item
The following subsections discuss each of these variants in alphabetical order according to the set_forms constant.
Set_forms Formobject (Active)
set_forms menu (active(menuitem)=value
   {, active(menuitem)=value})
Specifies whether the menu item is enabled or disabled. The value can be a keyword, integer constant, or integer variable as follows:
on | 1
Specifies that the menu item is enabled.
off | 0
Specifies that the menu item is disabled. When a menu item is disabled, it does not display in the window and cannot be selected
intvar
Specifies a 4GL expression evaluating to 0 or 1
When a menu item is disabled or enabled, the menu is redisplayed. Any menu key mappings that depend on the position of the items on the menu are adjusted accordingly. For example, suppose the function keys F1, F2, and F3 are mapped to the first three menu items as follows:
First(F1)   Second(F2)   Third(F3)   Fourth   End
Disabling the Second menu item results in F2 being mapped to the Third menu item and F3 being mapped to the Fourth menu item:
First(F1)    Third(F2)    Fourth(F3)    End
Enabling the Second menu item again results in the original mapping.
Set_forms Formobject (Change)
set_forms form (change = value)
set_forms field formname
    (change[(fieldname)] = value
    {, change[(fieldname)] = value})

set_forms row formname tablename [rownumber]
    (change[(columnname)] = value
    {, change[(columnname)] = value})
The three set_forms formobject statements, set_forms form (change), set_forms field (change), and set_forms row (change), reset the value of a change variable associated with a form, field, or a displayed column in a table field.
The value can be a keyword, integer constant, or integer variable as follows:
off | 0
Indicates that the data in a form, field, or table-field display has not been changed. Set the change variable to 0 if you want to clear the change variable to make it appear as though the runtime user had not entered data into the form object.
For a field, the change variable for is set to 0 automatically:
At the start of a display loop
When the field is cleared
When a new value is placed into the field by the program.
For a form, the change variable is set to 0 only at the start of a display loop.
on | 1
Indicates that changes have been made to the data in a form, field, or table-field display
intvar
Specifies a 4GL expression evaluating to 0 or 1
The rownumber in the syntax for the set_forms row (change) statement is optional. It specifies a row number in the referenced table-field display, and can only reference rows that display actual data. If you do not specify a rownumber, the statement refers to the current row (currently occupied by the cursor). Do not specify the rownumber within an unloadtable loop. In this case, the statement always refers to the row just unloaded.
If a table field has an associated data set, then each value in the data set also has an associated change variable.
Set_forms Formobject (Color)
set_forms field formname 
    (color [(fieldname)] = value 
    {, color [(fieldname)] = value})
set_forms column formname tablename 
    (color [(columnname)] = value 
    {, color [(columnname)] = value})
set_forms row formname tablename [rownumber]
    (color[(columnname)] = value
    {, color[(columnname)] = value})
The set_forms field (color), set_forms column (color), and set_forms row (color) statements set the color display of individual fields, table-field columns, or rows, respectively, on color monitors.
The value of color can be an integer in the range from 0 to 7, or the name of an integer field with a value in that range. The default color code is 0, indicating a terminal's default foreground color.
The color represented by the value is determined by the terminal setting for each terminal or PC. The termcap entry contains color code that are associated with the color settings for a terminal or PC that supports color.
Set_forms Formobject (Display)
set_forms field formname 
    (display [(fieldname)] =   value
    {, display [(fieldname)] = value})
set_forms column formname tablefieldname 
    (display [(columnname)] = value 
    {, display [(columnname)] = value})
set_forms row formname tablename [rownumber]
    (display[(columnname)] = value
    {, display[(columnname)] = value})
The set_forms field (display), set_forms column (display), and set_forms row (display) statements set display attributes for individual field, table-field columns, or rows dynamically.
The display parameter can be any of the FRS constants:
reverse
Turns reverse video on or off. The default is off.
blink
Turns blinking on or off. The default is off.
underline
Turns underline on or off. The default is off.
intensity
Changes the intensity of the display to half or bright intensity, depending on the monitor, if value is on. A value of off (the default) produces normal intensity.
displayonly
Turns the display only attribute on or off. The default is off.
Cannot be set for row.
invisible
Turns the invisibility attribute on or off. The default is off. Can be set in VIFRED.
Field only: Removes entire (table) field from view. Setting of field has higher precedence than setting of column for this attribute. (No column is visible unless the table is visible.)
Column only: Columns to right of invisible column shift to left, overlaying invisible column. If all columns of a table field are invisible, the entire table field is invisible. If a column setting changes, height of the table field row does not change.
Cannot be set for row.
normal
Setting to on specifies normal settings for all other display attributes except displayonly and invisible (that is, the other attributes are set to off). This applies to all settings except displayonly and invisible, which are not affected.
Note:   Ingres sets this attribute to off if any other attributes are turned on; you cannot give it a value of off.
Cannot be set for row.
format
Changes the field or table-field format dynamically. The new format must be compatible with the field's existing data type and cannot exceed the original size (number of rows and columns). Data in the field must be valid. For allowable forms of the format value, see "display formats" in this guide.
Cannot be set for row.
inputmasking
Turns input mask behavior on or off. The default is off. Input masks are a format specification that can restrict what characters can be entered into each of the positions in a field. The columnname or fieldname is required for this parameter. Cannot be set for row. For more information on input masking, see the appropriate section of this guide.
The value can be a keyword, integer constant, or integer variable as follows:
on | 1
Turns the display attribute on
off | 0
Turns the display attribute off
intvar
Specifies a 4GL expression evaluating to 0 or 1
These parameters can also be set in VIFRED. The default values do not apply if you specified different settings by editing the form in VIFRED.
Set_forms Formobject (Mode)
set_forms form (mode = modetype)
set_forms field formname (mode(tablefieldname ) =
    modetype)
To set the display mode for the current form, use the 4GL set_forms form (mode) statement. Unlike the mode statement, set_forms form (mode) performs no other functions in the process of changing the mode. It does not reinitialize the form, break the display, or affect the data, with the exception noted in the next paragraph. Field and table field values are unaffected by the change.
To set the display mode for a table field, use the set_forms field formname (mode) statement.
Important!  Changing to or from Query mode for a table field clears the data from the table field.
You can inquire on the display mode of the current form using the complementary inquire_forms statement. See Inquire_forms for information.
You can change the mode during submenu execution by using the set_forms form (mode) or set_forms field formname (mode) statements. Upon exiting the submenu, the form returns to the mode in effect before the submenu operation.
The modetype is a quoted character string constant, or the name of a field containing a character string constant, that specifies the form display mode. Modetypes for set_forms form (mode) and set_forms field formname (mode) are:
fill
Specifies that you can enter or change data (default mode)
update
Specifies that you can enter or change data
read
Specifies that you can examine but not change the data on the form
query
Specifies that you can enter comparison operators (such as =, >, <=) as well as data. This is required for a form on which you want to use the qualification function in a database query.
The following table shows the operations that take place when you dynamically set a table field mode:
Start Modetype
New Modetype
fill
update
read
query
fill
No action
Changes mode
Validates table field
Clears data set
update
Adds fake row if needed
No action
Validates table field
Clears data set
read
Adds fake row if needed
Changes mode
No action
Clears data set
Validate table field. 4GL validates the field prior to changing the mode. If validation fails, the mode does not change.
Clear data set. The table field, data set, and local variables are cleared. Hidden columns remain as previously defined. Moves the cursor to the first row/column cell of the table field. Performs any entry activations defined for the column if the cursor was not on the field before the mode change.
Add fake row, if needed. A table field in either Update or Read mode contains no rows at all. Table fields in Fill mode always have at least one row.
Additional considerations in setting modetype:
You cannot change the mode of an empty (uninitialized) table field.
You cannot specify an unknown mode while the mode of the field in question remains unchanged.
Aggregate derivation values can be invalidated (and cause a recalculation) when the mode of a table field changes. This can cause any derived fields dependent on the table field to be marked Invalid and recalculated.
Setting the mode of the parent form has no impact on this feature.
Set_forms Formobject (Rename)
set_forms menu formname
  (rename(oldname)=newname
  {, rename(oldname)=newname})
Renames the menuitem specified by oldname to the string value, newname. Once a menuitem is renamed, it cannot be accessed by the old name. All references to the menuitem must be to the new name.