GUI ScreenIO for Windows |
The definitions for a combobox reside in both the -3 and the -4 portions of the panel copybook. The list associated with the combobox is in the -3 area, and the selected value (or the value typed in the associated edit control) is in the -4 area. This makes a combobox very easy to use.
The copybook segments for a combobox are shown below: Notice the comments explain much of what you need to use it.
01 panel-3.
|
You can load data to the list at runtime in a little perform loop, like this. If you use the value in MY-COMBOBOX-MAX to terminate the perform, your code won't have to be modified if you change the number of elements in the list...
PERFORM
|
If you want to clear a previously loaded combobox, you should move LOW-VALUES to the table (MY-COMOBOBX-TBL in this example). Do not move spaces unless you want a list of multiple blank entries to appear in the drop-down. (Spaces are legal values in combo box entries).
If you want to have an item in the list appear selected when the combobox is activated, just set the selected byte for that item like this:
SET MY-COMBOBOX-SDX TO MY-COMBOBOX-IDX
|
Alternatively, you can load data to the edit control portion of the combobox:
MOVE mydata TO MY-COMBOBOX. |
NOTE: You should always clear (move LOW-VALUES to) MY-COMBOBOX-SELS if you wish to clear selections made (or set) previously. Otherwise, the system will select the item previously selected the next time you displayed this panel. This can be an annoyance for your users, and might cause data to "migrate" from record to record as they update successive records in a file. The SELs over-ride any value you place in the edit control.
Now, call GUI ScreenIO to display your panel. If the user changes MY-COMBOBOX by typing data or by selecting it from the list, the data will be found in this field when control returns from GUI ScreenIO.
You use the data just as you would data in any other field. If you want to MOVE it to a different field, do this:
MOVE MY-COMBOBOX TO mydata. |
Incidentally, if you press the right mouse button while it's over a combobox's edit control, you can use the standard Windows editing facilities, as shown here. This works in all edit controls, and it's automatic:
© 2000-2019 Norcom, all rights reserved |