GUI ScreenIO for Windows |
The definitions for a listbox reside in both the -3 and the -4 portions of the panel copybook. The list associated with the listbox 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 listbox very easy to use.
The copybook segments for a listbox are shown below: Notice the comments explain much of what you need to use it.
01 panel-3.
01 panel-4.
|
You can load data to the list at runtime in a little perform loop, like this.
If you use the value in MY-LISTBOX-MAX to terminate the perform, your code won't have to be modified if you change the number of elements in the list...
PERFORM
|
Clear un-used entries to low-values, not spaces.
If you want to have an item in the list appear selected when the listbox is activated, just set the selected byte for that item like this:
SET MY-LISTBOX-SDX TO MY-LISTBOX-IDX
|
When GUI ScreenIO returns to your program, it will tell you how many items were selected. If any were selected, examine the selection flags to see which item(s) were selected by the user. Use a little perform loop, like this.
IF NOT MY-LISTBOX-NONE-SELECTED
|
If you use the value in MY-LISTBOX-MAX to terminate the perform, your code won't have to be modified if you change the number of elements in the list... You could also count how many selected items you've processed, and stop the loop when it's equal to MY-LISTBOX.
Remember - it's possible to select more than one item from a listbox, so be sure to examine the entire list when you look for selections!
© 2000-2019 Norcom, all rights reserved |