Highlighted
Absent Member.
Absent Member.
1185 views

[archive] Display Message Box

[Migrated content. Thread originally posted on 16 February 2006]

Hi

Has anyone written their own MESSAGE BOX routine?

Shaun
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Display Message Box

The Working Storage has a field for holding 5 messages.
MESS-NR : is the number to read in a file.
MESS-FILENR : is the file nr to read the message out of
(our software has different languages)
MESS-MESSAGE : is the message read from the above file

In the DISPLAY-MESSAGE procedure, we reference the file to read in seperate paragraphs like SUBDISP1 and so on.


       78  NEWLINE                    VALUE H"0A".

       05 TELEZEN-MESSAGE OCCURS 5 INDEXED BY MESS-IDX.
            07 MESS-NR              PIC 9(4) COMP-3.
            07 MESS-FILENR          PIC 9.
            07 MESS-MESSAGE         PIC X(130).
       05 MESS-PTR                PIC S9(4) COMP-3.

       01  MESSAGE-BOX.
           05 MESS-MB-TITLE             PIC X(100).
              88 MESS-MB-ERROR-TITLE    VALUE "Lucas Error".
              88 MESS-MB-WARNING-TITLE  VALUE "Lucas Warning".
              88 MESS-MB-INFO-TITLE     VALUE "Lucas Info".
              88 MESS-MB-QUESTION-TITLE VALUE "Lucas ...".
           05 MESS-MB-TYPE              PIC 9.
              88 MESS-MB-OK             VALUE 1.
              88 MESS-MB-YES-NO         VALUE 2.
              88 MESS-MB-OK-CANCEL      VALUE 3.
              88 MESS-MB-YES-NO-CANCEL  VALUE 4.
           05 MESS-MB-ICON              PIC 9.
              88 MESS-MB-DEFAULT-ICON   VALUE 1.
              88 MESS-MB-WARNING-ICON   VALUE 2.
              88 MESS-MB-ERROR-ICON     VALUE 3.
           05 MESS-MB-DEFAULT           PIC 9.
              88 MESS-MB-YES-DEFAULT    VALUE 1.
              88 MESS-MB-NO-DEFAULT     VALUE 2.
              88 MESS-MB-CANCEL-DEFAULT VALUE 3.
           05 MESS-STRING               PIC X(400).
           05 MESS-TITLE                PIC X(80).



The following paragraphs are stored in a CPY-file.

      *
       LEEGMAKEN-MESSAGE.
           PERFORM LEEGMESS00 THRU LEEGMESS99.
       LEEGMESS00.
           PERFORM VARYING MESS-IDX FROM 1 BY 1 UNTIL MESS-IDX > 5
              INITIALIZE MESS-NR(MESS-IDX)     
                         MESS-MESSAGE(MESS-IDX)
                         MESS-FILENR(MESS-IDX)
           END-PERFORM.
       LEEGMESS99.
      *

      *
       SET-ERROR-MESSAGE.   
           PERFORM SET-ERR-MESS00 THRU SET-ERR-MESS99.
       SET-ERR-MESS00.
           PERFORM LEEGMAKEN-MESSAGE.
           SET MESS-MB-ERROR-TITLE    TO TRUE.
           SET MESS-MB-OK             TO TRUE.
           SET MESS-MB-ERROR-ICON     TO TRUE.
       SET-ERR-MESS99.
      *

      *
       SET-QUESTION-MESSAGE.
           PERFORM SET-QUEST-MESS00 THRU SET-QUEST-MESS99.
       SET-QUEST-MESS00.
           SET JUIST                  TO TRUE.
           PERFORM LEEGMAKEN-MESSAGE.
           SET MESS-MB-QUESTION-TITLE TO TRUE.
           SET MESS-MB-YES-NO         TO TRUE.
           SET MESS-MB-DEFAULT-ICON   TO TRUE.
       SET-QUEST-MESS99.
      *

      *
       SET-CANCEL-MESSAGE.
           PERFORM SET-CANC-MESS00 THRU SET-CANC-MESS99.
       SET-CANC-MESS00.
           PERFORM LEEGMAKEN-MESSAGE.
           SET MESS-MB-QUESTION-TITLE TO TRUE.
           SET MESS-MB-YES-NO-CANCEL  TO TRUE.
           SET MESS-MB-DEFAULT-ICON   TO TRUE.
       SET-CANC-MESS99.
      *

      *
       SET-INFO-MESSAGE.     
           PERFORM SET-INFO-MESS00 THRU SET-INFO-MESS99.
       SET-INFO-MESS00.
           PERFORM LEEGMAKEN-MESSAGE.
           SET MESS-MB-INFO-TITLE     TO TRUE.
           SET MESS-MB-OK             TO TRUE.
           SET MESS-MB-WARNING-ICON   TO TRUE.
       SET-INFO-MESS99.
      *

      *
       SET-WARNING-MESSAGE. 
           PERFORM SET-WARN-MESS00 THRU SET-WARN-MESS99.
       SET-WARN-MESS00.
           SET JUIST                  TO TRUE.
           PERFORM LEEGMAKEN-MESSAGE.
           SET MESS-MB-WARNING-TITLE  TO TRUE.
           SET MESS-MB-YES-NO         TO TRUE.
           SET MESS-MB-WARNING-ICON   TO TRUE.
       SET-WARN-MESS99.
      *

      *
       DISPLAY-MESSAGE.
           PERFORM DISPMESS00 THRU DISPMESS99.
       DISPMESS00.
           INITIALIZE MESS-PTR MESS-STRING.

           PERFORM VARYING MESS-IDX FROM 1 BY 1 UNTIL MESS-IDX >  5
              IF MESS-NR(MESS-IDX) NOT = ZERO
                 MOVE MESS-NR(MESS-IDX) TO WONR
                 EVALUATE MESS-FILENR(MESS-IDX)
                     WHEN 1 PERFORM SUBDISP1
                     WHEN 2 PERFORM SUBDISP2
                     WHEN 3 PERFORM SUBDISP3
                     WHEN 4 PERFORM SUBDISP4
                     WHEN 5 PERFORM SUBDISP5
                     WHEN 6 PERFORM SUBDISP6
                 END-EVALUATE
                 
                 MOVE PESS TO MESS-MESSAGE(MESS-IDX)
              END-IF
           END-PERFORM.
         
           MOVE 1            TO MESS-PTR.
           IF MESS-MESSAGE(1) NOT = SPACES
             STRING MESS-MESSAGE(1) DELIMITED BY ALL "   "
                    INTO MESS-STRING,
                    POINTER MESS-PTR
             END-STRING
           END-IF.

           IF MESS-MESSAGE(2) NOT = SPACES
              STRING NEWLINE
                     MESS-MESSAGE(2) DELIMITED BY ALL "   "
                     INTO MESS-STRING,
                     POINTER MESS-PTR
               END-STRING
            END-IF.

            IF MESS-MESSAGE(3) NOT = SPACES
               STRING NEWLINE
                      MESS-MESSAGE(3) DELIMITED BY ALL "   "
                      INTO MESS-STRING,
                      POINTER MESS-PTR
               END-STRING
             END-IF.

            IF MESS-MESSAGE(4) NOT = SPACES
               STRING NEWLINE
                      MESS-MESSAGE(4) DELIMITED BY ALL "   "
                      INTO MESS-STRING,
                      POINTER MESS-PTR
               END-STRING
             END-IF.

             IF MESS-MESSAGE(5) NOT = SPACES
               STRING NEWLINE
                      MESS-MESSAGE(5) DELIMITED BY ALL "   "
                      INTO MESS-STRING,
                      POINTER MESS-PTR
               END-STRING
             END-IF.

             INSPECT MESS-STRING
                REPLACING TRAILING SPACES BY LOW-VALUES.

       DISPMESS03.
             DISPLAY MESSAGE BOX MESS-STRING
                     TITLE IS MESS-MB-TITLE
                     TYPE IS MESS-MB-TYPE
                     ICON IS MESS-MB-ICON
                     DEFAULT IS MB-NO
                     GIVING STATUS-VALUE.
       DISPMESS99. 


Now, to generate for instance a info-message, the following procedure is invoced


      *
       BOODSCHAP-VERWERKING-SCANPAL.
           PERFORM VERWERKSCAN00 THRU VERWERKSCAN99.
       VERWERKSCAN00.
           PERFORM SET-INFO-MESSAGE.

           MOVE 68           TO MESS-NR(1).
           MOVE 69           TO MESS-NR(2).
           MOVE 202          TO MESS-NR(4).
           MOVE 203          TO MESS-NR(5).
           MOVE 1            TO MESS-FILENR(1) MESS-FILENR(2)
                                MESS-FILENR(4) MESS-FILENR(5).

           PERFORM DISPLAY-MESSAGE.
       VERWERKSCAN99.
      *



Maybe you can do it shorter, but it works just fine so hope this can help you.

Kind regards
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Display Message Box

Thanks Hans,

Thats very similar to our own messaging routine.

But what I really meant was something which doesn't use DISPLAY MESSAGE BOX.

The problem we have is that we run programs in a thread from the menu program.
Then when you have a few different programs running and one of them has to display a message box, the whole lot basically stop functioning until which ever program had the message box displayed answers it.

Hope that makes sense, but thanks for the detail anyway.

Shaun
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Display Message Box

Shaun,

We have our own message routine. It's pretty complicated as stuff has been added over the years, but we essentially just create a window, put the message details on it, and then close the window.

Rob
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.