# IupMessage

Definition: | include pGUI.e IupMessage(nullable_string title=NULL, nullable_string msg=NULL, dword_seq args={}, bool bWrap=true)
Description: | Shows a modal dialog containing a message with an OK button.
pwa/p2js: | Implemented as a simple alert(), which can look rather ugly, with no attempt at wordwrap or expanding the box to fit long messages. While it should in theory, and in time, be possible to drum up something better, anything beyond what it is now remains officially not supported.
See Also: | IupAlarm, IupMessageAlarm IupMessageDlg, IupMessageError
Comments: | If title is null it defaults to "Error". If msg is null then a window with just the title and an OK button is displayed. If args is a non-empty sequence then `msg=sprintf(msg,args)` is performed before the message is shown. If bWrap is true (the default) it converts each paragraph into a single line, thereby delegating wordwrap to the function. Uses global attributes "PARENTDIALOG" and "ICON" (but not on Windows as MessageBox does not have an icon in the title bar) if defined. There is no need for a separate IupMessagef function, since that functionality is covered by the optional args parameter - simply delete the trailing f. Important: Almost all applications will benefit from IupSetAttributeHandle(NULL,"PARENTDIALOG",dlg). It can really help to explicitly control focus behaviour for IupMessage() and the like, rather than rely on the often somewhat erratic default focus behaviour, especially on Windows.
Example: |
    include pGUI.e

    IupOpen()

    IupMessage("Oops","It went wrong.")

    IupClose()
See Also: | IupOpen, IupClose, IupMainLoop