| Version: 3.3.1

Public Member Functions | List of all members
wxRichMessageDialog Class Reference
Class List by Category » Common Dialogs

`#include <wx/richmsgdlg.h>`

Inheritance diagram for wxRichMessageDialog:
[legend]

## Detailed Description

Extension of wxMessageDialog with additional functionality.

This class adds the possibility of using a checkbox (that is especially useful for implementing the "Don't ask me again" kind of dialogs) and an extra explanatory text which is initially collapsed and not shown to the user but can be expanded to show more information.

Notice that currently the native dialog is used only under MSW. Elsewhere, a generic implementation which is less familiar to the users is used. Because of this it's recommended to use this class only if you do need its extra functionality and use wxMessageDialog which does have native implementation under all platforms otherwise. However if you do need to put e.g. a checkbox in a dialog, you should definitely consider using this class instead of using your own custom dialog because it will have much better appearance at least under recent Windows versions.

To use this class, you need to create the dialog object and call ShowCheckBox() and/or ShowDetailedText() to configure its contents. Other than that, it is used in exactly the same way as wxMessageDialog and supports all the styles supported by it. In particular, ShowModal() return value is the same as for wxMessageDialog. The only difference is that you need to use IsCheckBoxChecked() to examine the checkbox value if you had called ShowCheckBox().

Here is a simple example:

void MyFrame::ShowDialog()
{
if ( ... shouldn't show this dialog again ... )
return;
wxRichMessageDialog dlg(this, "Welcome to my wonderful program!");
dlg.ShowCheckBox("Don't show welcome dialog again");
dlg.ShowModal(); // return value ignored as we have "Ok" only anyhow
if ( dlg.IsCheckBoxChecked() )
... make sure we won't show it again the next time ...
}

Since
  2.9.2

##

Library: wxCore
Category: Common Dialogs

See also
  wxMessageDialog Overview

## Public Member Functions
| wxRichMessageDialog (wxWindow *parent, const wxString &message, const wxString &caption=wxMessageBoxCaptionStr, long style=wxOK|wxCENTRE)
| Constructor specifying the rich message dialog properties. More...
void | ShowCheckBox (const wxString &checkBoxText, bool checked=false)
| Shows a checkbox with a given label or hides it. More...
wxString | GetCheckBoxText () const
| Retrieves the label for the checkbox. More...
void | ShowDetailedText (const wxString &detailedText)
| Shows or hides a detailed text and an expander that is used to show or hide the detailed text. More...
wxString | GetDetailedText () const
| Retrieves the detailed text. More...
void | SetFooterText (const wxString &footerText)
| Shows or hides a footer text that is used at the bottom of the dialog together with an optional icon. More...
wxString | GetFooterText () const
| Retrieves the footer text. More...
void | SetFooterIcon (int icon)
| Specify the footer icon set together with the footer text. More...
int | GetFooterIcon () const
| Retrieves the footer icon. More...
bool | IsCheckBoxChecked () const
| Retrieves the state of the checkbox. More...
virtual int | ShowModal ()
| Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO. More...

## Constructor & Destructor Documentation

## ◆ wxRichMessageDialog()

wxRichMessageDialog::wxRichMessageDialog | ( | wxWindow * | parent,
|  | const wxString & | message,
|  | const wxString & | caption = `wxMessageBoxCaptionStr`,
|  | long | style = `wxOK|wxCENTRE`
| ) |  |

Constructor specifying the rich message dialog properties.

Works just like the constructor for wxMessageDialog.

## Member Function Documentation

## ◆ GetCheckBoxText()

wxString wxRichMessageDialog::GetCheckBoxText | ( |  | ) | const

Retrieves the label for the checkbox.

Returns
  The label for the checkbox, will be the empty string if no checkbox is used.

## ◆ GetDetailedText()

wxString wxRichMessageDialog::GetDetailedText | ( |  | ) | const

Retrieves the detailed text.

Returns
  The detailed text or empty if detailed text is not used.

## ◆ GetFooterIcon()

int wxRichMessageDialog::GetFooterIcon | ( |  | ) | const

Retrieves the footer icon.

Returns
  The footer icon or 0 if footer icon is not used.

See also
  SetFooterIcon()

Since
  3.1.1

## ◆ GetFooterText()

wxString wxRichMessageDialog::GetFooterText | ( |  | ) | const

Retrieves the footer text.

Returns
  The footer text or empty if footer text is not used.

Since
  3.1.1

## ◆ IsCheckBoxChecked()

bool wxRichMessageDialog::IsCheckBoxChecked | ( |  | ) | const

Retrieves the state of the checkbox.

If this method is called before showing the dialog, the initial value of the checkbox, as set by ShowCheckBox() is used. If it is called after calling wxDialog::ShowModal(), the value set by the user is returned.

Returns
  true if the checkbox is checked or false if not.

## ◆ SetFooterIcon()

void wxRichMessageDialog::SetFooterIcon | ( | int | icon | ) |

Specify the footer icon set together with the footer text.

Valid values are `wxICON_INFORMATION`, `wxICON_WARNING`, `wxICON_AUTH_NEEDED` and `wxICON_ERROR` (notice that `wxICON_QUESTION` is not allowed here).

See also
  GetFooterIcon(), SetFooterText()

Since
  3.1.1

## ◆ SetFooterText()

void wxRichMessageDialog::SetFooterText | ( | const wxString & | footerText | ) |

Shows or hides a footer text that is used at the bottom of the dialog together with an optional icon.

Parameters

  footerText | The footer text if empty no footer text will be used.

See also
  SetFooterIcon(), GetFooterText()

Since
  3.1.1

## ◆ ShowCheckBox()

void wxRichMessageDialog::ShowCheckBox | ( | const wxString & | checkBoxText,
|  | bool | checked = `false`
| ) |  |

Shows a checkbox with a given label or hides it.

Parameters

  checkBoxText | If the parameter is non-empty a checkbox will be shown with that label, otherwise it will be hidden.
  checked | The initial state of the checkbox.

## ◆ ShowDetailedText()

void wxRichMessageDialog::ShowDetailedText | ( | const wxString & | detailedText | ) |

Shows or hides a detailed text and an expander that is used to show or hide the detailed text.

Parameters

  detailedText | The detailed text that can be expanded when the dialog is shown, if empty no detailed text will be used.

## ◆ ShowModal()

virtual int wxRichMessageDialog::ShowModal | ( |  | ) |
| virtual

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

IsCheckBoxChecked() can be called afterwards to retrieve the value of the check box if one was used.