# IupMessageDlg

Definition: | include pGUI.e Ihandle ih = IupMessageDlg()
Description: | Creates the Message Dialog element. It is a predefined dialog for displaying a message. The dialog can be shown with the IupPopup function only. Returns: the identifier of the created element, or NULL if an error occurs.
pwa/p2js: | Not supported. See also the comments on IupMessage.
See Also: | IupAlarm, IupMessage, IupMessageAlarm, IupMessageError
Notes: | The IupMessageDlg is a native pre-defined dialog not altered by IupSetLanguage(). To show the dialog, use function IupPopup. The dialog is mapped only inside IupPopup, IupMap does nothing. In Windows the position (x,y) used in IupPopup is ignored and the dialog is always centered on screen. The IupMessage function simply creates and popup a IupMessageDlg. In Windows each different dialog type is always associated with a different beep sound. In Windows, if PARENTDIALOG is specified then it will be modal relative only to its parent.
Attributes: |
BUTTONDEFAULT | Number of the default button. Can be "1", "2" or "3". "2" is valid only for "RETRYCANCEL", "OKCANCEL" and "YESNO" button configurations. "3" is valid only for "YESNOCANCEL". Default: "1".
BUTTONRESPONSE | Number of the pressed button. Can be "1", "2" or "3". Default: "1".
BUTTONS | Buttons configuration. Can have values: "OK", "OKCANCEL", "RETRYCANCEL", "YESNO", or "YESNOCANCEL". Default: "OK". Additionally the "Help" button is displayed if the HELP_CB callback is defined. (RETRYCANCEL and YESNOCANCEL since 3.16)
DIALOGTYPE | Type of dialog defines which icon will be displayed besides the message text. Can have values: "MESSAGE" (No Icon), "ERROR" (Stop-sign), "WARNING" (Exclamation-point), "QUESTION" (Question-mark) or "INFORMATION" (Letter "i"). Default: "MESSAGE".
PARENTDIALOG | (creation only) Name of a dialog to be used as parent. This dialog will be always in front of the parent dialog. If not defined in Motif the dialog could not be modal.
TITLE | Dialog title.
VALUE | Message text.
Callbacks: |
HELP_CB | Action generated when the Help button is pressed.
Example: |
    Ihandln msgdlg = IupMessageDlg()

    IupSetAttribute(msgdlg, "DIALOGTYPE", "WARNING")
    IupSetAttribute(msgdlg, "TITLE", "IupMessageDlg Test")
    IupSetAttribute(msgdlg, "BUTTONS", "OKCANCEL")
    IupSetAttribute(msgdlg, "VALUE", "Message Text\nSecond Line")
    IupSetCallback(msgdlg, "HELP_CB", Icallback("help_cb"))
    IupSetAttributeHandle(msgdlg,"PARENTDIALOG",maindlg)

    IupPopup(msgdlg, IUP_CURRENT, IUP_CURRENT)

    printf(1,"BUTTONRESPONSE(%s)\n", {IupGetAttribute(msgdlg, "BUTTONRESPONSE")})

    msgdlg = IupDestroy(msgdlg)
Note that dlg has an Ihandln type for the benefit of IupDestroy(); IupMessageDlg() will throw a (catchable) exception rather than return NULL.
See Also: | IupSetAttribute, IupSetCallback, IupPopup, IupDestroy