A listview-GET-PRIOR event is returned when the listview needs records that precede those you've previously loaded.
A listview-GET-PRIOR event occurs when the user scrolls the list towards the beginning of the list further than the first record that's been loaded to the cache.
| In panel-3 area | Data |
| listview-GET-FROM-KEY | The value of the invisible key column for the first record in the listview cache. |
| 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. |
Position the file to the record having the key that was returned in listview-GET-FROM-KEY, then load the listview backwards from this point in the file.
The key and percentage of the last record in the listview buffer must match the key and percentage of the first record in the cache; that is, you must reload the record with the key that was returned to you in listview-GET-FROM-KEY.
Note that this is precisely the reverse of your response to a listview-GET-NEXT.
|
PERFORM WITH TEST AFTER
CALL 'GS' USING panel-1
END-PERFORM. |
Here's the general form of the performed routine that loads the listview buffer.
Note that you must move 0 percent to the first record that was successfully loaded to indicate to the listview that you have loaded the first record in the list. Once the listview has received a record with 0 in the percentage, it will no longer return listview-GET-PRIOR events (unless this record has been discarded from the cache by GUI ScreenIO's caching algorithm).
|
BROWSE-BACKWARD.
|
See listview-GET-NEXT for problems commonly encountered when loading listviews.
The listview-GET-PRIOR event is used to insert data at the beginning of GUI ScreenIO's listview cache when it is required. This "just-in-time" strategy of loading data to a listview means that there is no particular delay when browsing a very large file with a listview, and also reduces memory utilization.
Preload cache is discussed in the topic listview-GET-NEXT. You will never receive a listview-GET-PRIOR event if a listview uses preload caching.
Accumulate caching works much like preload cache, except that it only returns listview-GET-PRIOR events when needed, instead of loading the entire list at once. Like preload caching, it's best when used for relatively small files.
Specify accumulate caching in the panel editor using the listview properties. Choose the Listview Behavior tab, then click the radiobutton for Accumulate Cache.
If you didn't begin loading an accumulate-cache listview from the beginning, and the user scrolls backwards beyond what's in the cache, you'll receive a listview-GET-PRIOR event.
Likewise, if the user drags the scrollbar thumb a long way toward the beginning of a list that wasn't loaded from the beginning, you'll receive a series of listview-GET-PRIOR events until the listview receives a record with a percentage that matches the scrollbar thumb position (which can be tricky if your file system doesn't support percentages). If your list is very large, it may take a considerable time for the listview to load all of the data up to the scrollbar thumb position, since accumulate-caching listviews always load the data sequentially.
Accumulate caching is sometimes useful when your file system doesn't handle percentages well, or when you want to keep all of the data you've loaded to the cache in memory.
On the other hand, if you've written the code to handle the listview-GET-PRIOR event, there's really no point to using accumulate (or preload) caching; you would be better served by using the default listview caching.
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.
When you respond to a listview-GET-PRIOR event, GUI ScreenIO inserts the records that you supply in the listview buffer, in front of the records already in its cache. If the cache size exceeds the internal maximum, records will be deleted from the end in order to accommodate the records you're adding to the beginning of the cache.
Preload caching causes the cache to be expanded as required to hold the entire list.
Accumulate caching causes the cache to be expanded on demand as records are loaded, until the entire list has been loaded.
| © 2000-2006 Norcom, all rights reserved |