wxMessageDialog Class Reference
[Common Dialogs]

#include <wx/msgdlg.h>

Inheritance diagram for wxMessageDialog:
Inheritance graph
[legend]

Detailed Description

This class represents a dialog that shows a single or multi-line message, with a choice of OK, Yes, No and Cancel buttons.

Styles

This class supports the following styles:

Library:  wxCore
Category:  Common Dialogs
See also:
wxMessageDialog Overview

Public Member Functions

 wxMessageDialog (wxWindow *parent, const wxString &message, const wxString &caption=wxMessageBoxCaptionStr, long style=wxOK|wxCENTRE, const wxPoint &pos=wxDefaultPosition)
 Constructor specifying the message box properties.
virtual void SetExtendedMessage (const wxString &extendedMessage)
 Sets the extended message for the dialog: this message is usually an extension of the short message specified in the constructor or set with SetMessage().
virtual void SetMessage (const wxString &message)
 Sets the message shown by the dialog.
virtual bool SetOKCancelLabels (const ButtonLabel &ok, const ButtonLabel &cancel)
 Overrides the default labels of the OK and Cancel buttons.
virtual bool SetOKLabel (const ButtonLabel &ok)
 Overrides the default label of the OK button.
virtual bool SetYesNoCancelLabels (const ButtonLabel &yes, const ButtonLabel &no, const ButtonLabel &cancel)
 Overrides the default labels of the Yes, No and Cancel buttons.
virtual bool SetYesNoLabels (const ButtonLabel &yes, const ButtonLabel &no)
 Overrides the default labels of the Yes and No buttons.
virtual int ShowModal ()
 Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO.

List of all members.


Constructor & Destructor Documentation

wxMessageDialog::wxMessageDialog ( wxWindow parent,
const wxString message,
const wxString caption = wxMessageBoxCaptionStr,
long  style = wxOK|wxCENTRE,
const wxPoint pos = wxDefaultPosition 
)

Constructor specifying the message box properties.

Use ShowModal() to show the dialog.

style may be a bit list of the identifiers described above.

Notice that not all styles are compatible: only one of wxOK and wxYES_NO may be specified (and one of them must be specified) and at most one default button style can be used and it is only valid if the corresponding button is shown in the message box.

Parameters:
parent Parent window.
message Message to show in the dialog.
caption The dialog title.
style Combination of style flags described above.
pos Dialog position (ignored under MSW).

Member Function Documentation

virtual void wxMessageDialog::SetExtendedMessage ( const wxString extendedMessage  )  [virtual]

Sets the extended message for the dialog: this message is usually an extension of the short message specified in the constructor or set with SetMessage().

If it is set, the main message appears highlighted -- if supported -- and this message appears beneath it in normal font. On the platforms which don't support extended messages, it is simply appended to the normal message with an empty line separating them.

Since:
2.9.0
virtual void wxMessageDialog::SetMessage ( const wxString message  )  [virtual]

Sets the message shown by the dialog.

Since:
2.9.0
virtual bool wxMessageDialog::SetOKCancelLabels ( const ButtonLabel &  ok,
const ButtonLabel &  cancel 
) [virtual]

Overrides the default labels of the OK and Cancel buttons.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetOKLabel ( const ButtonLabel &  ok  )  [virtual]

Overrides the default label of the OK button.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetYesNoCancelLabels ( const ButtonLabel &  yes,
const ButtonLabel &  no,
const ButtonLabel &  cancel 
) [virtual]

Overrides the default labels of the Yes, No and Cancel buttons.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetYesNoLabels ( const ButtonLabel &  yes,
const ButtonLabel &  no 
) [virtual]

Overrides the default labels of the Yes and No buttons.

The arguments of this function can be either strings or one of the standard identifiers, such as wxID_APPLY or wxID_OPEN. Notice that even if the label is specified as an identifier, the return value of the dialog ShowModal() method still remains one of wxID_OK, wxID_CANCEL, wxID_YES or wxID_NO values, i.e. this identifier changes only the label appearance but not the return code generated by the button. It is possible to mix stock identifiers and string labels in the same function call, for example:

        wxMessageDialog dlg(...);
        dlg.SetYesNoLabels(wxID_SAVE, _("&Don't save"));

Also notice that this function is not currently available on all platforms (although as of wxWidgets 2.9.0 it is implemented in all major ports), so it may return false to indicate that the labels couldn't be changed. If it returns true, the labels were set successfully.

Typically, if the function was used successfully, the main dialog message may need to be changed, e.g.:

        wxMessageDialog dlg(...);
        if ( dlg.SetYesNoLabels(_("&Quit"), _("&Don't quit")) )
            dlg.SetMessage(_("What do you want to do?"));
        else // buttons have standard "Yes"/"No" values, so rephrase the question
            dlg.SetMessage(_("Do you really want to quit?"));
Since:
2.9.0
virtual int wxMessageDialog::ShowModal (  )  [virtual]

Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO.

Notice that this method returns the identifier of the button which was clicked unlike wxMessageBox() function.

Reimplemented from wxDialog.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



wxWidgets logo

[ top ]