GUI ScreenIO for Windows

 ScreenIO.com


The listview-EDITED event

A listview-EDITED event is returned when the user modifies the data in column 1 of a record. 

Data returned with this event

Required to process this event

In panel-3 area Data
listview-REC1-COL1 The new data for column 1 of your record. 

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.

Usual response

Use the value in listview-SEL1-KEY to read the record, update the record with the new value from the column 1 field in the first occurrence of the listview buffer, and then reload the updated record to the listview buffer. 

GUI ScreenIO will match the key and percentage of the record in the listview buffer with the corresponding record in its cache, and will update the cache so the new data is correctly displayed in the list.

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-EDITED
-->        MOVE listview-SEL1-KEY TO record-KEY
-->        SET file-command-READ TO TRUE
-->        CALL file-I-O-routine USING file-commands
-->                                    data-record
-->        IF valid-file-status
-->          MOVE listview-REC1-COL1 TO record-column-1-data
-->          SET file-command-REWRITE TO TRUE
-->          CALL file-I-O-routine USING file-commands
-->                                      data-record
-->          IF valid-file-status     
-->           
SET listview-IDX TO 1
-->           
PERFORM LOAD-DATA-TO-LISTVIEW
-->          END-IF
-->        END-IF

           .
           .
           .

       END-EVALUATE

     END-PERFORM.


 LOAD-DATA-TO-LISTVIEW.

     MOVE record-PERCENT TO listview--PERCENT (listview-IDX).
     MOVE record-KEY     TO listview--KEY     (listview-IDX).

     MOVE record-data    TO listview-column-1 (listview-IDX).
     MOVE record-data    TO listview-column-2 (listview-IDX).
     MOVE record-data    TO listview-column-n (listview-IDX).


Remarks

You do this by "slow-clicking" the item; click on it once to select it, pause, then click again.  If you enabled this in the listview properties in the editor, the runtime will open an edit control over the selected data and allow the user to enter new data.

Windows only permits a user to update column 1 of a listview; you may not update other columns.

Update the listview by loading the modified record to the listview buffer.  GUI ScreenIO will match the record's key and percentage with the record in its cache, and update the record in the cache.

You cannot add or update records this way, nor can you change the key; you need to reset and reload the list to reflect additions or deletions.  This is usually quite painless because of the caching algorithm.

Related topics:


2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom