GUI ScreenIO for Windows

 ScreenIO.com


Invisible keys in a Listview or Treeview

Listview and treeview controls will save your record keys for you so that you don't need to keep track of them; in fact, it's essential to provide the keys of your records to a listview when you load data to it so that it can pass you the keys of records the user selected and keys needed to process GET-NEXT and GET-PRIOR events.

However, the invisible key data can be any sort of data; the content is up to you, though it would be wise to have a unique primary key be part of the data. 

For example, you could define your invisible key field as 19 bytes of non-numeric data, and then do this:

 01  INVISIBLE-KEY-DATA.
     05  IK-PRIMARY-KEY          PIC X(8).
     05  IK-PERCENT              PIC S9(3)V9(6).
     05  IK-RECORD-WHATEVER      PIC XX.

     .
     .
     .

 LOAD-DATA-TO-LISTVIEW.

     MOVE record-KEY     TO IK-PRIMARY-KEY.
     MOVE record-PERCENT TO IK-PERCENT.
     MOVE whatever       TO IK-WHATEVER.

     MOVE INVISIBLE-KEY-DATA TO listview--KEY (listview-IDX).

The code above shows how you can associate any kind of data - not just a key - with the records you load to a listview or treeview.  This can be extremely useful.


2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom