Sample Multiple Working-set Application
Main subroutine for sets 2-4 (panel-level flow control)
The first subroutine of each working-set does the flow-control for the entire
set, so it's the most complex program of each working-set.
The logic just examines ACTIVE-PANEL to determine which subroutine needs to
be called to handle the panel which is becoming active. If ACTIVE-PANEL is
invalid, it will simply display the default panel; the first one in the set.
Switching working-sets
When the user changes from this set to a different one (that was opened
previously), panel PSET2 receives the event PSET2-EVENT-INACTIVATED.
PSET2-ACTIVATED-PANEL-NAME will contain the name of the panel that is to be
activated (the one that the user clicked), and PSET2-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.
Closing a working-set
To close a given working-set, simply close the first panel by setting
PSET2-DO-CLOSE to TRUE and calling GUI ScreenIO to update the panel. The
panel will return a PSET2-EVENT-INACTIVATED, which will be handled by the normal
flow-control logic; nothing special needs to be done when you close a
working-set.
Closing other panels than the first in a working-set
Closing the first panel of a working-set will cause GUI ScreenIO to
automatically close all open panels in that set; as we've said many other times,
it is not necessary to close the other panels manually.
Just as in a simple, single working-set application, GUI ScreenIO will close
panels automatically when it is appropriate. This also applies to all but
the first panel within a given working-set. When you redisplay a panel,
GUI ScreenIO automatically closes all of the panels that were displayed after
it, within the same workiing set.
Do not manually close other than the first panel in a working-set; it's
potentially confusing, not needed, and simply clutters your program with
unnecessary code.
End of job
If the user clicks on the X box in the upper-right corner of the main
panel, you will receive a panel-EVENT-CLOSE-AND-STOP.
The correct response is simply to set END-OF-JOB to TRUE, and return to the
main program.
IDENTIFICATION DIVISION.
PROGRAM-ID. SET2.
DATE-COMPILED.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-PC.
OBJECT-COMPUTER. IBM-PC.
DATA DIVISION.
WORKING-STORAGE SECTION.
* ------------------------: Panel copybook:
COPY PSET2.
LINKAGE SECTION.
01 WORKING-SET-DATA.
05
ACTIVE-PANEL 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.
* ------------------------: Set the working-set of this panel
MOVE ACTIVE-SET TO PSET2-WORKING-SET.
EVALUATE TRUE
WHEN ACTIVE-PANEL = 'PSET2A'
CALL 'SET2A' USING
WORKING-SET-DATA
WHEN ACTIVE-PANEL = 'PSET2B'
CALL 'SET2B' USING
WORKING-SET-DATA
WHEN OTHER
CONTINUE
END-EVALUATE.
* ------------------------: Test to see if the working-set has
*
: changed (user switched from a
*
: subordinate panel to another working-
*
: set).
*
:
*
: If it is still this working-set,
*
: (re)display the set's first panel.
IF ACTIVE-SET = PSET2-WORKING-SET
PERFORM WITH TEST AFTER
UNTIL
ACTIVE-SET NOT = PSET2-WORKING-SET
CALL 'GS' USING PSET2-1
PSET2-2
PSET2-3
PSET2-4
EVALUATE TRUE
* ------------------------: Flow control:
*
: User clicked a panel in another
*
: working set.
WHEN
PSET2-EVENT-INACTIVATED
MOVE PSET2-ACTIVATED-PANEL-NAME TO ACTIVE-PANEL
MOVE PSET2-ACTIVATED-WORKING-SET TO ACTIVE-SET
* ------------------------: Flow control:
*
: User clicked the CONTAINER's "X" box
*
: (Close the application)
*
WHEN
PSET2-EVENT-CLOSE-AND-STOP
SET END-OF-JOB TO TRUE
* ------------------------: Flow control:
*
: User clicked "X" box of the FIRST
*
: popup in this working set. This
*
: will close the working-set.
*
WHEN
PSET2-EVENT-CLOSE-WINDOW
SET PSET2-DO-CLOSE TO TRUE
* ------------------------: Call a subroutine to display another
*
: popup in this working-set.
WHEN
PSET2-DISPLAY-POPUP2A
CALL 'SET2A' USING WORKING-SET-DATA
* ------------------------: Call a subroutine to display another
*
: popup in this working-set.
WHEN
PSET2-DISPLAY-POPUP2B
CALL 'SET2B' USING WORKING-SET-DATA
* ------------------------: Call a subroutine to display another
*
: popup in this working-set.
WHEN
PSET2-DISPLAY-MODAL-POPUP
CALL 'SETX' USING WORKING-SET-DATA
* ------------------------: User pressed the FINISHED button:
*
: Close this working-set.
*
WHEN
PSET2-FINISHED
SET PSET2-DO-CLOSE TO TRUE
END-EVALUATE
END-PERFORM.
GOBACK. |