resume Statement—Resume the Display Loop
This statement positions the cursor and resumes the display loop.
Syntax
resume
resume next
resume field fieldname
resume column tablename columnname
resume menu
resume entry
resume nextfield
resume previousfield
Description
The resume statement terminates the currently executing operation and returns control to the FRS. When control resumes, the screen cursor is situated at one of several possible locations, depending on the syntax of the resume.
If an operation does not have a resume statement, once the operation is completed the cursor resumes on the same field as before the operation. Thus, the default action at the end of an operation is equivalent to a simple resume statement, without any object names.
The resume statement must be syntactically within an activate or initialize block, as it generates a local goto statement to the beginning of the display block. If the resume statement is located within an unloadtable statement nested within an activate section, resume exits the unloadtable loop, in addition to terminating the activate operation and resuming the display loop.
If a resume statement positions the cursor to a field or column that has entry activations, the activations are executed.
The Resume Next Statement
The resume next statement must appear within an activate field or activate column section. Resume next directs the FRS to continue with whatever operation the user selected that caused the activation.
Resume next behaves differently depending on whether the activation is the result of a cursor movement out of a field or a menu key, FRS key, or menu item selection:
• Activation initiated by cursor movement
Resume next causes completion of the cursor movement. For example, if an attempt to move forward out of a field initiated a field activation operation, resume next positions the cursor on the next field in the form. Similarly, if the field activation had been initiated by an attempt to move the cursor to the previous field, the resume next positions the cursor on the previous field in the form. In the case of column activation, resume causes the cursor to resume on the next column, the previous column, the row above or the row below, depending on what action precipitated the activation. If a scroll attempt had initiated the activation, a scroll occurs.
For example, assume that resume next is included in the activation block for the field emp_name and that the program turns on previousfield activations:
exec frs set_frs frs (activate(previousfield) = 1) ;
Then, when the user types the FRS previousfield command (Ctrl P on many terminals) while the cursor rests on the field emp_name, the field's activate block runs. The resume next in the activate block moves the cursor to the previous field.
• Activation as the result of a menu key, FRS key, or menu item selection.
The selection is suspended while the field activation is executing. To complete the suspended selection, use resume next in the activation block; other resume statements causes the suspended selection to be discarded.
Selections are completed as follows:
– Menu key selection
The cursor is placed on the menu line, ready for menu item input.
– FRS key selection
The block of code associated with the selected FRS key is executed.
– Menuitem selection
The block of code associated with the selected menu item is executed.
The Resume Field Statement
In the resume field variant, fieldname can be specified using a string, with or without quotes, or as a string program variable. The field can be either a simple field or a table field. If the field is a table field, the cursor is placed on the first row and first column, unless the cursor was in the table field when the resume field statement executed. In such cases, the cursor resumes on the current row.
The Resume Nextfield Statement
The resume nextfield variant puts the cursor on the first accessible field or table field column that is next in the tab sequence. If the current field is a table field column, then the next field is the first accessible column to the right in the table field. If the current field is the last accessible column in a table field, the cursor is moved off the table field to the first accessible field, or table field column, that is after the table field in the tab sequence.
If there are no other accessible fields on the form then no operation occurs if a resume nextfield statement is issued.
The Resume Previousfield Statement
The resume previousfield variant puts the cursor on the first accessible field or table field column that is before the current field in the tab sequence. If the current field is a table field column, then the previous field is the first accessible column to the left in the table field. If the cursor is already on the first accessible column in a table field, then the cursor is moved off the table field to the first accessible field, or table field column, that is before the table field in the tab sequence.
If there are no other accessible fields on the form then no operation occurs if a resume previousfield statement is issued.
Other Resume Statements
In the resume column variant, tablename and columnname can be expressed as strings, with or without quotes, or as program variables.
You cannot use the resume menu and resume entry variants to resume on a regular submenu.
Examples—resume statement:
Example 1:
Terminate the operation, with cursor on field empname.
exec frs resume field empname;
Example 2:
Terminate the operation, with cursor on the menu line.
exec frs resume menu;
Example 3:
Terminate a field or column activation operation, and complete the cursor movement that initiated the operation, or complete a suspended menu key, FRS key, or menu item selection.
exec frs resume next;
Example 4:
Provide a menu item to re-initialize the current field by executing the field entry block again. When the resume entry statement executes, the field activation block is executed.
exec frs activate menuitem 'Reinitialize Field';
exec frs begin;
exec frs message 'Reinitializing field';
exec frs sleep 2;
exec frs resume entry;
exec frs end;
exec frs activate before field 'fld1'
exec frs begin;
exec frs set_frs field '' (reverse(fld1)=1);
exec frs end;