Version: 3.0.5
Loading...
Searching...
No Matches
msgdlg.h File Reference

Classes

class  wxMessageDialog
 This class represents a dialog that shows a single or multi-line message, with a choice of OK, Yes, No and Cancel buttons. More...
 
class  wxMessageDialog::ButtonLabel
 Helper class allowing to use either stock id or string labels. More...
 

Functions

int wxMessageBox (const wxString &message, const wxString &caption=wxMessageBoxCaptionStr, int style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
 Show a general purpose message dialog.
 

Variables

const char wxMessageBoxCaptionStr [] = "Message"
 Default message box caption string.
 

Function Documentation

◆ wxMessageBox()

int wxMessageBox ( const wxString message,
const wxString caption = wxMessageBoxCaptionStr,
int  style = wxOK|wxCENTRE,
wxWindow parent = NULL,
int  x = wxDefaultCoord,
int  y = wxDefaultCoord 
)

Show a general purpose message dialog.

This is a convenient function which is usually used instead of using wxMessageDialog directly. Notice however that some of the features, such as extended text and custom labels for the message box buttons, are not provided by this function but only by wxMessageDialog.

The return value is one of: wxYES, wxNO, wxCANCEL, wxOK or wxHELP (notice that this return value is different from the return value of wxMessageDialog::ShowModal()).

For example:

int answer = wxMessageBox("Quit program?", "Confirm",
wxYES_NO | wxCANCEL, main_frame);
if (answer == wxYES)
main_frame->Close();
#define wxCANCEL
Definition defs.h:461
#define wxYES_NO
Definition defs.h:460
#define wxYES
Definition defs.h:457
int wxMessageBox(const wxString &message, const wxString &caption=wxMessageBoxCaptionStr, int style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Show a general purpose message dialog.

message may contain newline characters, in which case the message will be split into separate lines, to cater for large messages.

Parameters
messageMessage to show in the dialog.
captionThe dialog title.
parentParent window.
styleCombination of style flags described in wxMessageDialog documentation.
xHorizontal dialog position (ignored under MSW). Use wxDefaultCoord for x and y to let the system position the window.
yVertical dialog position (ignored under MSW).

Include file:

#include <wx/msgdlg.h> 

Variable Documentation

◆ wxMessageBoxCaptionStr

const char wxMessageBoxCaptionStr[] = "Message"

Default message box caption string.