Programming Guide : Working with Arrays, Table Fields, and Collections : Table Field Operations : How You Can Scroll Through Data
 
Share this page          
How You Can Scroll Through Data
A user can scroll the displayed data in a table field in one of the following ways:
Vertical scroll bar
Navigation keys: arrow keys, Page Up, Page Down, Home, and End keys
Single-character find
Note:  Scrolling through data changes the current row to one of the visible rows and may also change selections. For more information about how selections are affected, depending on how the SelectionType and ScrollingChangesSelection attributes are set, see the Workbench User Guide.
How You Can Use the Vertical Scroll Bar
The scroll bar can be used to scroll line by line or page up or page down. You also can drag the thumb of the scroll bar for longer scrolls.
How You Can Use Navigation Keys to Scroll
The up and down arrow keys select a new row and cause scrolling if that row is not visible. Page Up and Page Down scroll a single page. The Home and End keys scroll to the first or last page of the table field.
Note:  If the current field is changeable, the navigation keys apply to that field, provided the field is of a type that uses that particular key.
How You Can Use Single-character Find
When a user positions the cursor in a column that has an entry field as its protofield and types a letter or number, the cursor moves to the first row whose value in that column begins with the specified letter or number. Each time the user types the character, the cursor moves to the next row whose column value begins with that character.
In searching for a specified character, when the cursor reaches the last row of the table field, it loops back to the first row.
Because typing in a field whose mode is changeable actually displays the value in the field, you can use single-character find only when the column is Landable but not Changeable.
You can disable this feature for a column in either of the following ways:
Use the Property Inspector to set the HasSingleCharacterFind attribute.
Set the HasSingleCharacterFind attribute in your 4GL code.
For example, the following code disables this feature for the vid_no column of the vlist table field:
field(vlist[*].vid_no).HasSingleCharFind = FALSE;
To implement a custom find operation for a table field whose bias is changeable, use the ArrayObject's Find method. For an explanation about using the Find method, see How You Can Scroll Indirectly with the Find Method.
How You Can Trigger SetValue, Exit, and Scroll Events
When a user scrolls through data using the single character find feature or an arrow key, the action triggers a SetValue event, an Exit event, or both, for the field being exited.
When a user uses the scroll bar, a SetValue or Exit event is triggered only if the row that had the current input focus scrolls out of the display. If the current row remains displayed, you can determine whether the user scrolled through the data by using a Scroll event.
The Scroll event is triggered when the user clicks the scroll bar of a table field with an interactive bias (FB_LANDABLE or FB_CHANGEABLE). The Scroll event is also triggered when scrolling occurs due to use of a scrolling key, Page Down, Page Up, Home, or End.
If a SetValue or Exit event is triggered by moving the scroll bar, these events are executed before the Scroll event. Because the Scroll event is not chained off the SetValue or Exit events, a resume statement in either of those events does not affect the running of the Scroll event.
For more information about Scroll events, see the Language Reference Guide. For more information about event chains, see Managing Event Queues.