GUI ScreenIO for Windows

 ScreenIO.com


Issuing Messages

Every panel copybook includes fields that make it easy to display program messages. 

Like most other things in GUI ScreenIO, you use 88 level items to instruct GUI ScreenIO how to display your message.  The portion of your panel copybook that controls how messages are displayed looks like this.

 01 panel-1.
        .
        .
*                              : Use this to display a message:
        10 panel-MESSAGE-TEXT PIC X(120) VALUE SPACE.
*                              : Where to display the message.
        10 panel-MESSAGE-DESTINATION PIC S9(4) COMP-5 VALUE 0.
          88 panel-MESSAGE-NOT-DISPLAYED              VALUE 0.
          88 panel-MESSAGE-BAR-BEEP                   VALUE 1.
          88 panel-MESSAGE-BAR-SILENT                 VALUE 2.
          88 panel-MESSAGE-BAR-PERSIST                VALUE 3.
          88 panel-MESSAGE-IN-MESSAGEBOX              VALUE 10.

To display a message, simply move your message text to the text field, set the destination of your message by setting the appropriate 88 level item TRUE, and the next time you call GUI ScreenIO, your message will be displayed.

So, to display a message in a standard Windows messagebox, do this:

     MOVE 'My message text' TO panel-MESSAGE-TEXT
     SET panel-MESSAGE-IN-MESSAGEBOX TO TRUE
     CALL 'GS' USING panel-1 ...

Customized messageboxes

If you want to display a messagebox with your own title and a few more buttons, you enable Customized Message Boxes using the Panel Properties. 

Checking this option creates a slightly expanded copybook definition that looks like this:

*                              : Use this to display a message:
         10 panel-MESSAGE-TEXT PIC X(120)              VALUE SPACE.
*                              : Where to display the message.
         10 panel-MESSAGE-DESTINATION PIC S9(4) COMP-5 VALUE 0.
           88 panel-MESSAGE-NOT-DISPLAYED              VALUE 0.
           88 panel-MESSAGE-BAR-BEEP                   VALUE 1.
           88 panel-MESSAGE-BAR-SILENT                 VALUE 2.
           88 panel-MESSAGE-BAR-PERSIST                VALUE 3.
           88 panel-MESSAGE-IN-MESSAGEBOX              VALUE 10.

*                              : If using a custom message box,
*                              : Select icon and buttons to use.
         10 FILLER REDEFINES panel-MESSAGE-DESTINATION.
           15 panel-MSGBOX-ICON       PIC 9.
             88 panel-MB-INFO-ICON                     VALUE 0.
             88 panel-MB-EXCLAIM-ICON                  VALUE 1.
             88 panel-MB-QUESTION-ICON                 VALUE 2.
             88 panel-MB-STOP-ICON                     VALUE 3.
           15 panel-MSGBOX-BUTTONS    PIC 9.
             88 panel-MB-BTN-OK                        VALUE 0.
             88 panel-MB-BTN-OKCANCEL                  VALUE 2.
             88 panel-MB-BTN-RETRYCANCEL               VALUE 3.
             88 panel-MB-BTN-YESNO                     VALUE 4.
             88 panel-MB-BTN-YESNOCANCEL               VALUE 5.
             88 panel-MB-BTN-ABRTRETRYIGN              VALUE 6.
*                              : Win2k only....
             88 panel-MB-BTN-CANCELTRYCON              VALUE 7.

To display your customized messagebox, you move in the text as before, but you also set the type of icon to be displayed, and which buttons should be on the messagebox. 

For example, to display the customized messagebox with a STOP sign icon, and three buttons; Abort, Retry, and Ignore:

     MOVE 'My message text' TO panel-MESSAGE-TEXT
     SET panel-MB-STOP-ICON TO TRUE
     SET panel-MB-BTN-ABRTRETRYIGN TO TRUE
     CALL 'GS' USING panel-1 ...

You can can figure out which button was pressed when GUI ScreenIO returns to your program because the customized messagebox option adds these 88 level items beneath the event ID field:

             88 panel-EVENT-MB-ABORT      VALUE 8050.
             88 panel-EVENT-MB-CANCEL     VALUE 8051.
             88 panel-EVENT-MB-CONTINUE   VALUE 8052.
             88 panel-EVENT-MB-IGNORE     VALUE 8053.
             88 panel-EVENT-MB-NO         VALUE 8054.
             88 panel-EVENT-MB-OK         VALUE 8055.
             88 panel-EVENT-MB-RETRY      VALUE 8056.
             88 panel-EVENT-MB-TRYAGAIN   VALUE 8057.
             88 panel-EVENT-MB-YES        VALUE 8058.

You display a messagebox and test which button was pressed just as you would any of the other events that are defined for your panel, e.g., like this:

     MOVE 'My message text' TO panel-MESSAGE-TEXT
     SET panel-MB-STOP-ICON TO TRUE
     SET panel-MB-BTN-ABRTRETRYIGN TO TRUE

* ------------------------: Display the panel.

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

     EVALUATE TRUE

       WHEN panel-EVENT-MB-ABORT
         PERFORM ...

       WHEN panel-EVENT-MB-CANCEL
         PERFORM ...

       WHEN panel-EVENT-MB-CONTINUE
         PERFORM ...

       WHEN panel-EVENT-MB-IGNORE
         PERFORM ...

       WHEN panel-EVENT-MB-NO
         PERFORM ...

       WHEN panel-EVENT-MB-OK
         PERFORM ...

       WHEN panel-EVENT-MB-RETRY
         PERFORM ...

       WHEN panel-EVENT-MB-TRYAGAIN
         PERFORM ...

       WHEN panel-EVENT-MB-YES
         PERFORM ...
*                         : Ignore events of no interest
       WHEN OTHER
         CONTINUE

     END-EVALUATE


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom