Was this helpful?
The Field Condition
For the field condition you can specify two options:
Entry activation
Specifies that the code is executed when the user moves the cursor into the specified field
Exit activation
Specifies that the code is executed when the user moves the cursor out of the specified field. (Field exit activations do not occur if the form is displayed in read mode.)
To specify an entry activation, use the following syntax:
activate before field fieldname | all
begin
     program code;
end
To specify an exit activation, use the following syntax:
activate [after] field fieldname | all
begin
    program code;
end
By default, the activation occurs only when the user moves the cursor into or out of a field. (Entry activations are also executed when the resume field statement places the cursor on a field.) If you want to execute the code as a result of some other user action, for example, whenever the user presses a function key or selects a menu item while the cursor resides on the specified field, use the set_frs statement or an explicit activate clause. The set_frs statement, described later in this chapter, can define global field activations. See the descriptions of the menuitem and frskey conditions for a description of how to use the activate clause.
Fieldname must be a quoted or unquoted character string or program variable identifying a simple field. If you specify all, the program code is executed upon entry or exit, as specified, of all simple fields on the form. (To specify entry or exit activation of table field columns, use the activate column version of the activate statement.) Fieldname cannot identify a derived field, because a user cannot move the cursor to these fields.
If a display block includes an activate field all and an activate section for an individual field, only the code associated with whichever of the two activations appears second in the display block is executed when an activation on that particular field occurs.
By default, after an exit activation, the FRS positions the cursor back on the field that caused the activation. Consequently, be sure to include a resume statement that moves the cursor to another field when the operation is complete.
The resume next statement is very important if the field activation is the result of a menuitem or frskey selection. Without this statement, the block of code associated with the selected menuitem or frskey condition is not executed. It appears as if the menuitem or frskey condition was never selected.
Last modified date: 11/09/2022