]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxMessageDialog}}\label{wxmessagedialog} | |
2 | ||
3 | This class represents a dialog that shows a single or multi-line message, | |
4 | with a choice of OK, Yes, No and Cancel buttons. | |
5 | ||
6 | \wxheading{Derived from} | |
7 | ||
8 | \helpref{wxDialog}{wxdialog}\\ | |
9 | \helpref{wxWindow}{wxwindow}\\ | |
10 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
11 | \helpref{wxObject}{wxobject} | |
12 | ||
13 | \wxheading{Include files} | |
14 | ||
15 | <wx/msgdlg.h> | |
16 | ||
17 | \wxheading{See also} | |
18 | ||
19 | \helpref{wxMessageDialog overview}{wxmessagedialogoverview} | |
20 | ||
21 | \latexignore{\rtfignore{\wxheading{Members}}} | |
22 | ||
23 | ||
24 | \membersection{wxMessageDialog::wxMessageDialog}\label{wxmessagedialogctor} | |
25 | ||
26 | \func{}{wxMessageDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message},\rtfsp | |
27 | \param{const wxString\& }{caption = "Message box"}, \param{long }{style = wxOK \pipe wxCANCEL},\rtfsp | |
28 | \param{const wxPoint\& }{pos = wxDefaultPosition}} | |
29 | ||
30 | Constructor. Use \helpref{wxMessageDialog::ShowModal}{wxmessagedialogshowmodal} to show the dialog. | |
31 | ||
32 | \wxheading{Parameters} | |
33 | ||
34 | \docparam{parent}{Parent window.} | |
35 | ||
36 | \docparam{message}{Message to show on the dialog.} | |
37 | ||
38 | \docparam{caption}{The dialog caption.} | |
39 | ||
40 | \docparam{style}{A dialog style (bitlist) containing flags chosen from the following: | |
41 | ||
42 | \twocolwidtha{5cm} | |
43 | \begin{twocollist} | |
44 | \twocolitem{{\bf wxOK}}{Show an OK button.} | |
45 | \twocolitem{{\bf wxCANCEL}}{Show a Cancel button.} | |
46 | \twocolitem{{\bf wxYES\_NO}}{Show Yes and No buttons.} | |
47 | \twocolitem{{\bf wxYES\_DEFAULT}}{Used with {\bf wxYES\_NO}, makes {\bf Yes} button the default - which is the default behaviour.} | |
48 | \twocolitem{{\bf wxNO\_DEFAULT}}{Used with {\bf wxYES\_NO}, makes {\bf No} button the default.} | |
49 | \twocolitem{{\bf wxICON\_EXCLAMATION}}{Shows an exclamation mark icon.} | |
50 | \twocolitem{{\bf wxICON\_HAND}}{Shows an error icon.} | |
51 | \twocolitem{{\bf wxICON\_ERROR}}{Shows an error icon - the same as wxICON\_HAND.} | |
52 | \twocolitem{{\bf wxICON\_QUESTION}}{Shows a question mark icon.} | |
53 | \twocolitem{{\bf wxICON\_INFORMATION}}{Shows an information (i) icon.} | |
54 | \twocolitem{{\bf wxSTAY\_ON\_TOP}}{The message box stays on top of all other window, even those of the other applications (Windows only).} | |
55 | \end{twocollist} | |
56 | } | |
57 | ||
58 | \docparam{pos}{Dialog position. Not Windows.} | |
59 | ||
60 | ||
61 | \membersection{wxMessageDialog::\destruct{wxMessageDialog}}\label{wxmessagedialogdtor} | |
62 | ||
63 | \func{}{\destruct{wxMessageDialog}}{\void} | |
64 | ||
65 | Destructor. | |
66 | ||
67 | ||
68 | \membersection{wxMessageDialog::ShowModal}\label{wxmessagedialogshowmodal} | |
69 | ||
70 | \func{int}{ShowModal}{\void} | |
71 | ||
72 | Shows the dialog, returning one of wxID\_OK, wxID\_CANCEL, wxID\_YES, wxID\_NO. | |
73 | ||
74 | ||
75 | \membersection{wxMessageDialog::SetYesNoLabels}\label{wxmessagedialogsetyesnolabels} | |
76 | ||
77 | \func{bool}{SetYesNoLabels}{\param{const wxString&}{yes},\param{const wxString&}{no}} | |
78 | ||
79 | Overrides the default labels of the Yes and No buttons. | |
80 | ||
81 | Notice that this function is not currently available on all platforms, so it | |
82 | may return \false to indicate that the labels couldn't be changed. If it | |
83 | returns \true (currently only under wxMac), the labels were set successfully. | |
84 | Typically, if the function was used successfully, the main dialog message may | |
85 | need to be changed, e.g.: | |
86 | \begin{verbatim} | |
87 | wxMessageDialog dlg(...); | |
88 | if ( dlg.SetYesNoLabels(_("&Quit"), _("&Don't quit")) ) | |
89 | dlg.SetMessage(_("What do you want to do?")); | |
90 | else // buttons have standard "Yes"/"No" values, so rephrase the question | |
91 | dlg.SetMessage(_("Do you really want to quit?")); | |
92 | \end{verbatim} | |
93 | ||
94 | ||
95 | \membersection{wxMessageDialog::SetYesNoCancelLabels}\label{wxmessagedialogsetyesnocancellabels} | |
96 | ||
97 | \func{bool}{SetYesNoCancelLabels}{\param{const wxString&}{yes},\param{const wxString&}{no},\param{const wxString&}{cancel}} | |
98 | ||
99 | Overrides the default labels of the Yes, No and Cancel buttons. | |
100 | ||
101 | Please see the remarks in | |
102 | \helpref{SetYesNoLabels}{wxmessagedialogsetyesnolabels} documentation. | |
103 | ||
104 | ||
105 | \membersection{wxMessageDialog::SetOKLabel}\label{wxmessagedialogsetyesoklabel} | |
106 | ||
107 | \func{bool}{SetOKLabel}{\param{const wxString&}{ok}} | |
108 | ||
109 | Overrides the default label of the OK button. | |
110 | ||
111 | Please see the remarks in | |
112 | \helpref{SetYesNoLabels}{wxmessagedialogsetyesnolabels} documentation. | |
113 | ||
114 | ||
115 | \membersection{wxMessageDialog::SetOKCancelLabels}\label{wxmessagedialogsetokcancellabels} | |
116 | ||
117 | \func{bool}{SetOKCancelLabels}{\param{const wxString&}{ok},\param{const wxString&}{cancel}} | |
118 | ||
119 | Overrides the default labels of the OK and Cancel buttons. | |
120 | ||
121 | Please see the remarks in | |
122 | \helpref{SetYesNoLabels}{wxmessagedialogsetyesnolabels} documentation. | |
123 | ||
124 | ||
125 | \membersection{wxMessageDialog::SetMessage}\label{wxmessagedialogsetmessage} | |
126 | ||
127 | \func{void}{SetMessage}{\param{const wxString&}{msg}} | |
128 | ||
129 | Sets the message shown by the dialog. | |
130 | ||
131 | ||
132 | \membersection{wxMessageDialog::SetExtendedMessage}\label{wxmessagedialogsetextendedmessage} | |
133 | ||
134 | \func{void}{SetExtendedMessage}{\param{const wxString&}{exMsg}} | |
135 | ||
136 | Sets the extended message for the dialog: this message is usually an extension | |
137 | of the short message specified in the constructor or set with | |
138 | \helpref{SetMessage}{wxmessagedialogsetmessage}. If it is set, the main message | |
139 | appears highlighted -- if supported -- and this message appears beneath it in | |
140 | normal font. On the platforms which don't support extended messages, it is | |
141 | simply appended to the normal message with a new line separating them. | |
142 |