GUI ScreenIO for Windows

 ScreenIO.com


Sample Multiple Working-set Application

Subroutine for set 1

This sample application only has one panel in set one, a base panel.  It is a simple menu that lets you choose which other working-set you want to open. 

Opening new working-sets

When you press a button or select a menu option to open a different set, this program just returns the number of the set that's been requested in the argument ACTIVE-SET and then returns to the main program. 

Switching working-sets

When the user changes from this set to a different one (that was opened previously), panel PSET1 receives the event PSET1-EVENT-INACTIVATED.  PSET1-ACTIVATED-PANEL-NAME will contain the name of the panel that is to be activated (the one that the user clicked), and PSET1-ACTIVATED-WORKING-SET contains the working-set of the panel which is to become active. 

This routine simply moves the content of these fields to ACTIVE-PANEL and ACTIVE-SET, respectively, and then returns to the main program. 

Again, the main program will examines ACTIVE-SET to determine which subroutine needs to be called to activate the desired panel.

End of job

Because the panel in this program is a base panel, it will receive PSET1-EVENT-CLOSE-AND-STOP if the user clicks the X box in the upper-right corner of the panel, indicating the user wants to terminate the application.

The correct response is simply to set END-OF-JOB to TRUE, and return to the main program. 

 IDENTIFICATION DIVISION.
 PROGRAM-ID. SETDEMO.
 DATE-COMPILED.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER. IBM-PC.
 OBJECT-COMPUTER. IBM-PC.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
* ------------------------: Panel copybook:
     COPY PSET1.
 LINKAGE SECTION.
 01  WORKING-SET-DATA.
     05 ACTIVE-NAME         PIC X(8).
     05 ACTIVE-SET          PIC S9(4) COMP-5.
       88 END-OF-JOB        VALUE 0.
 PROCEDURE DIVISION USING WORKING-SET-DATA.

 FLOW-CONTROL.

     PERFORM WITH TEST AFTER
         UNTIL ACTIVE-SET NOT = 1

       CALL 'GS' USING PSET1-1
                       PSET1-2
                       PSET1-3
                       PSET1-4

       EVALUATE TRUE

* ------------------------: Flow control:
*                         : User clicked a panel in another
*                         : working set.
*
         WHEN PSET1-EVENT-INACTIVATED
           MOVE PSET1-ACTIVATED-PANEL-NAME TO ACTIVE-NAME
           MOVE PSET1-ACTIVATED-WORKING-SET TO ACTIVE-SET
*
* ------------------------: Flow control:
*                         : User clicked the CONTAINER's "X" box
*                         : (Close the application)

         WHEN PSET1-EVENT-CLOSE-AND-STOP
           SET END-OF-JOB TO TRUE

* ------------------------: User pressed button to open set 2.

         WHEN PSET1-OPEN-SET2 OR PSET1-MENU-OPEN-SET2
           MOVE 2 TO ACTIVE-SET

* ------------------------: User pressed button to open set 3.
*
         WHEN PSET1-OPEN-SET3 OR PSET1-MENU-OPEN-SET3
           MOVE 3 TO ACTIVE-SET

* ------------------------: User pressed button to open set 4.

         WHEN PSET1-OPEN-SET4 OR PSET1-MENU-OPEN-SET4
           MOVE 4 TO ACTIVE-SET

       END-EVALUATE

     END-PERFORM.
     GOBACK.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom