NGU-MESSAGEBOX Dialog

This document covers the following topics:


Natural Object Name

NGUMBDI1

Description

Displays a message box, for example with the title: "Dialog editor" and the message "Information message box" with an "OK" style push button that is selected by default. Please note that such a message box is modal (the end user can only leave it with a choice).

OPEN DIALOG Parameters

Name/Data Type Explanation
HANDLE OF GUI USING clause/Input The parent dialog of the message box.
Button (A1) WITH clause/Output Returns the selected button (for possible output values, see below).
Message (A253) WITH clause/Input (BY VALUE) Here you specify the message to be issued.
Title (A50) WITH clause/Input (BY VALUE) Here you specify the message box title.
Style (A32) WITH clause/Input (BY VALUE) The type of message box (for possible input values, see below).
"Button" Value Selected Button
O OK push button.
C Cancel push button.
Y Yes push button.
N No push button.
R Retry push button.

 

"Style" Value Message Box Type
I blue lower-case "i" in a round icon, Information Provides information about the results of a command. Offers no user choices; the user acknowledges the message by clicking the OK button.
! exclamation mark, Warning Alerts the user to a condition or situation that requires the user's decision and input before proceeding, such as an impending action with potentially destructive, irreversible consequences.
S stop sign, Critical Informs the user of a serious problem that requires intervention or correction before work can continue.
? This sign is no longer recommended as it does not clearly represent a type of message. The system continues to support its inclusion only for backward compatibility.
may be combined with:  
O OK push button (default).
OC OK and Cancel push buttons.
YNC Yes, No, and Cancel push buttons.
YN Yes and No push buttons.
RC Retry and Cancel push buttons until the end user responds to the message box.
may be combined with:  
1 Make the first push button the default.
2 Make the second push button the default.
3 Make the third push button the default.

Note:
If the messagebox has the style "C", an OK button is generated because a messagebox with only a Cancel button is not supported.

Example:

OPEN DIALOG NGU-MESSAGEBOX  
    USING NULL-HANDLE 
    WITH #BUTTON 
    'Do you want to save the changes ?'  /* These parameters are  
    'Exit editor' '?YNC1'                /* passed BY VALUE 

Separator Keyword

END-OF-LINE

You use this keyword to force line breaks in message box texts when using the NGU-MESSAGEBOX dialog. To do so, first embed this keyword in the alphanumeric "Message" string using the COMPRESS statement, for example:

   COMPRESS 'HELLO' END-OF-LINE 'THIS IS A MESSAGE' TO #MESSAGE 

You should, however, only use this technique if the text of the message clearly breaks into more than one line, because this overrides system-provided formatting.

Usage in Enter or Leave Event Handlers

Before you open this dialog in an enter or leave event handler, you have to set the attributes SUPPRESS-ENTER-EVENT and SUPPRESS-LEAVE-EVENT to TRUE. This avoids an infinite loop on opening the dialog (when the messagebox appears, another enter and leave event occurs for the dialog or dialog element containing the enter or leave event handler). After the messagebox has been invoked, you modify the attributes to value FALSE again.