Title: Can I modify the GUI controls of a Screen program from a called routine?

Sometimes you may want to have some special routines that could be capable to apply similar changes to the GUI controls of one or more screen programs.

For example, let's say you have a combo-box that shows the names of the days of a week and you use such combo box on many screen programs and you want to avoid having each program fill that combo-box. Instead, you want a routine that may fill the combo-box for all the screen programs that require it.

This can be easily done by passing the handle of the control, defined in the calling program, to the called routine. And then, the called routine may populate it in a generic way.

The critical code for that could be as follows:

   WORKING-STORAGE SECTION.
   ...
   77  cb1-handle handle of combo-box.
   ...
   SCREEN SECTION.
   01  screen-1.
       03 CB1
          Combo-box
   ...
Then in Procedure Division:
   ...
   set cb1-handle to handle of cb1.
   call "filldays" using cb1-handle.
   ...
In the calling program:

   LINKAGE SECTION.
   77  cb1-handle handle of combo-box.

   PROCEDURE DIVISION USING cb1-handle.

   MAIN.
       modify cb1-handle 
              item-to-add "Monday"
              item-to-add "Tuesday"
              item-to-add "Wednesday"
              item-to-add "Thursday"
              item-to-add "Friday"
              item-to-add "Saturday"
              item-to-add "Sunday".
   ...

Attached you can find two sample programs that fully illustrate this sample case.

Authored by: Veryant Support on Fri, Dec 4th, 2020 at 7:00 PM
This question has been viewed 1555 times so far.
Online URL: http://support.veryant.com/support/phpkb/question.php?ID=315

Powered by PHPKB Knowledge Base Software