17. Forms Statements : activate Statement--Activate a Section of Code : The Scroll Condition
 
Share this page                  
The Scroll Condition
The scroll condition has the following syntax:
activate scrollup | scrolldown tablename
begin
    program code;
end
The scroll condition is activated when the user attempts a scroll in the table field specified by tablename.
The scrollup condition occurs when the user tries to move the screen cursor past the last displayed row of the table field. This activates the scrollup condition, because the rows in the table field must move up to bring in any rows below the display. The scrolldown condition occurs when the user tries to move the cursor above the first row of the table field; the existing rows in the table field must move down to accommodate the new row coming in at the top.
In a table field the user can also activate scrolling by attempting a page scroll up or down using an FRS command. (FRS commands are built-in functions that control cursor movement and screen display. See the Character-based Querying and Reporting Tools User Guide for more information about them.) When a page scroll is attempted, the activate scroll block is executed for each row that the cursor scrolls through. Execution of the scroll statement does not constitute a scroll attempt and does not activate the scroll condition.
Ordinarily a scroll attempt automatically causes the specified scroll to occur. However, if an activate scroll is specified for the particular direction, that automatic scrolling does not occur. Instead, the program executes the statements in the activate block. A scroll statement must be included in the statement block to actually effect the scrolling. If the block does not include a scroll statement, the user is not able to scroll in the direction specified in the activate statement. A simple way to disable scrolling in a particular direction is to include an activate scroll statement with an empty program block for that direction.
Applications that use table fields do not commonly contain activate scroll blocks, except to handle certain special circumstances. For instance, it might be necessary to force a complex validation check, such as a check using a database table, on a row before it is scrolled.
The tablename is the name of a currently displayed table field. It can be specified as a character string, with or without quotes, or as a program variable.