GUI ScreenIO for Windows

 ScreenIO.com


The listview-START-AT event

A listview-START-AT event is returned when the listview needs you to provide records beginning at a specified percentage into the file. 

It occurs when the user drags the scrollbar thumb significantly beyond the beginning or end of the data already loaded to the listview. 

Data returned with this event

Required to process this event

In panel-3 area Data
listview-START-AT-PERCENT The position of the scrollbar thumb as a percentage along the scrollbar.

Returned but not used to handle this event

In panel-3 area Data
listview-MAX Maximum number records that may be passed in the listview buffer, useful for PERFORMed loops when loading records to  your listview buffer.
listview-SCROLL-TO-KEY Set to HIGH-VALUES.
listview-SEL1-KEY The value of the invisible key column for the first selected record in the list.
listview-SEL2-KEY The value of the invisible key column for the last selected record record in the list. 

Note:  Since GUI ScreenIO does not presently support a selection range (multiple record selections), this field is always the same as listview-SEL1-KEY.

listview-TOP-OF-LIST-KEY The value of the invisible key column for the first (top) record that is visible in the listview control.
All other fields Set to LOW-VALUES.
In panel-4 area Data
listview Number of items in the list that are selected.

Required response

Position the file to that percentage along the keypath, then load the listview as you would for a listview-GET-NEXT. 

Sample code

     PERFORM WITH TEST AFTER
         UNTIL panel-EVENT-CLOSE-WINDOW
            OR panel-EVENT-CLOSE-AND-STOP

       CALL 'GS' USING panel-1
                       panel-2
                       panel-3
                       panel-4

       EVALUATE TRUE

-->      WHEN listview-START-AT
-->        MOVE listview-START-AT-PERCENT TO file-command-PERCENT
-->        PERFORM START-AT-PERCENT

           .
           .
           .

       END-EVALUATE

     END-PERFORM.

Here's the general form of the performed routine that positions the file and loads the listview buffer.  The PERFORMed routine BROWSE-FORWARD is also used to load the listview the first time and in response to a listview-GET-NEXT event.

 START-AT-PERCENT.

     SET file-command-START-AT-PERCENT TO TRUE.
     CALL file-I-O-routine USING file-commands
                                 data-record.
 
* ------------------------: If the START was successful,
*                             load data to the listview.

     IF valid-file-status
       PERFORM BROWSE-FORWARD.


Remarks

Suppose your file consists of a million records and the user dragged the scrollbar thumb to the halfway mark.  If you load the listview sequentially you'd need to read 500,000(!) records before you'd have loaded the data the user wanted.

The listview-START-AT event allows you to go directly to the desired records and load the data on demand.  This gives great performance when browsing very large databases, plus it uses memory very efficiently (which also improves performance).

GUI ScreenIO only returns a listview-START-AT event when the scrollbar thumb is dragged some distance beyond the current position.  If the thumb is only dragged a small amount, you will receive listview-GET-NEXT event(s) instead of a listview-START-AT event.

Percentages

The listview implementation requires that you be able to position the file to a percentage along the keypath, and that you be able to supply this percentage with each record loaded to the listview.

Go here for a complete discussion of percentages with respect to using listviews, and one technique of synthesizing percentages for file systems (like ISAM) which do not provide them.

Internal Listview Cache management

When you respond to a listview-START-AT event, GUI ScreenIO discards previously cached records for this listview and begins caching from this new point in the list.

Related topics:


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom