GUI ScreenIO for Windows

 ScreenIO.com


Monolithic programming model - without annotation

Here's the complete sample application.  You can see the annotated version here.

If you would like to see how we'd do this with subroutines, go here.

 IDENTIFICATION DIVISION.
 PROGRAM-ID. SAMPLE.
 DATE-COMPILED.
* ------------------------: GUI ScreenIO Sample Application.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SOURCE-COMPUTER. IBM-PC.
 OBJECT-COMPUTER. IBM-PC.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
* ------------------------: Panel copybooks.
     COPY SAMPMAIN.
     COPY SAMPLE1.
     COPY SAMPLE2.
*
PROCEDURE DIVISION.
* ------------------------: Create the main window.

     PERFORM DISPLAY-MAIN-PANEL.

* ------------------------: Handle the first panel; this could
*                         : also be a subroutine...

     PERFORM DISPLAY-SAMPLE1.
*
* ------------------------: Close the main before doing a STOP RUN

     SET SAMPMAIN-DO-CLOSE TO TRUE.
     PERFORM DISPLAY-MAIN-PANEL.
     STOP RUN.


 DISPLAY-MAIN-PANEL.
* ------------------------: Update the application's main panel.

     CALL 'GS' USING SAMPMAIN-1
                     SAMPMAIN-2
                     SAMPMAIN-3
                     SAMPMAIN-4.


 DISPLAY-SAMPLE1.
* ------------------------: Loop to handle the base panel.

     SET DISPLAY-IN-MESSAGEBOX-ON TO TRUE
*
     PERFORM WITH TEST AFTER
         UNTIL SAMPLE1-EVENT-CLOSE-WINDOW
            OR SAMPLE1-EVENT-CLOSE-AND-STOP
            OR SAMPLE1-FILE-EXIT

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

* ------------------------: This just increments a counter that
*                         : shows how many times the panel has
*                         : been displayed.
 
       ADD 1 TO EDIT-CYCLE-COUNTER

* ------------------------: This portion of the performed loop
*                         : processes events that caused GUI
*                         : ScreenIO to return.

       EVALUATE TRUE

* ------------------------: Menu selection: File/Display Popup

         WHEN SAMPLE1-MENU-SHOW-POPUP
           PERFORM DISPLAY-SAMPLE2

* ------------------------: Button pressed: Display Popup

         WHEN SAMPLE1-BUTTON-SHOW-POPUP
           PERFORM DISPLAY-SAMPLE2

* ------------------------: Button pressed: Move data from one
*                         : edit control to another, then move
*                         : space to the first edit control.

         WHEN SAMPLE1-BUTTON-MOVE-1-TO-2
           MOVE EDIT-CONTROL-1 TO EDIT-CONTROL-2
           MOVE SPACE TO EDIT-CONTROL-1

* ------------------------: Button pressed: Display the text
*                         : from the "Message text" edit control
*                         : in a message box or in the status bar,
*                         : depending on a radiobutton.

         WHEN SAMPLE1-DISPLAY-MESSAGE
           MOVE MESSAGE-TEXT TO SAMPLE1-MESSAGE-TEXT
           IF DISPLAY-IN-MESSAGEBOX-ON
             SET SAMPLE1-MESSAGE-IN-MESSAGEBOX TO TRUE
           ELSE
             SET SAMPLE1-MESSAGE-BAR-BEEP TO TRUE
           END-IF

* ------------------------: Disregard all other events.

         WHEN OTHER
           CONTINUE

       END-EVALUATE

     END-PERFORM.


 DISPLAY-SAMPLE2.
* ------------------------: Loop to handle the popup panel.
*
     PERFORM WITH TEST AFTER
         UNTIL SAMPLE2-EVENT-CLOSE-WINDOW
            OR SAMPLE2-EVENT-CLOSE-AND-STOP

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

       EVALUATE TRUE

* ------------------------: Button pressed: Display text in
*                         : a message box.

         WHEN SAMPLE2-DISPLAY-MESSAGE
           SET SAMPLE2-MESSAGE-IN-MESSAGEBOX TO TRUE
           MOVE 'Sample messagebox.' TO SAMPLE2-MESSAGE-TEXT

* ------------------------: Disregard all other events.

         WHEN OTHER
           CONTINUE

       END-EVALUATE

     END-PERFORM.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom