IupMessageDlg (since 3.0)

Creates the Message Dialog element. It is a predefined dialog for displaying a message. The dialog can be shown with the IupPopup function only.


Ihandle* IupMessageDlg(void); [in C]
iup.messagedlg{} -> (elem: ihandle) [in Lua]
messagedlg() [in LED]

Returns: the identifier of the created element, or NULL if an error occurs.


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.


HELP_CB: Action generated when the Help button is pressed.


The IupMessageDlg is a native pre-defined dialog not altered by IupSetLanguage.

To show the dialog, use function IupPopup. In Lua, use the popup function.

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.

In GTK uses the gtk_message_dialog, in Windows uses MessageBox, and in Motif uses xmMessageBox.


Ihandle* dlg = IupMessageDlg();

IupSetAttribute(dlg, "DIALOGTYPE", "WARNING");
IupSetAttribute(dlg, "TITLE", "IupMessageDlg Test");
IupSetAttribute(dlg, "BUTTONS", "OKCANCEL");
IupSetAttribute(dlg, "VALUE", "Message Text\nSecond Line");
IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);


printf("BUTTONRESPONSE(%s)\n", IupGetAttribute(dlg, "BUTTONRESPONSE"));

Windows XP

See Also

IupMessage, IupScanf, IupListDialog, IupAlarm, IupGetFile, IupPopup