]> git.saurik.com Git - wxWidgets.git/commitdiff
Add possibility to change the test message box title in dialog sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 17 Apr 2012 13:57:18 +0000 (13:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 17 Apr 2012 13:57:18 +0000 (13:57 +0000)
All the other message box elements were configurable, so why not this one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/dialogs/dialogs.cpp
samples/dialogs/dialogs.h

index d281082dd8ed1ce3033adcd9e20224fdd48f5f11..d9c650ae2955bd767ca01bd99572c1ba4646024f 100644 (file)
@@ -2931,6 +2931,10 @@ bool TestMessageBoxDialog::Create()
     // this sizer allows to configure the messages shown in the message box
     wxSizer * const
         sizerMsgs = new wxStaticBoxSizer(wxVERTICAL, this, "&Messages");
+    sizerMsgs->Add(new wxStaticText(this, wxID_ANY, "&Title:"));
+    m_textTitle = new wxTextCtrl(this, wxID_ANY, "Test Message Box");
+    sizerMsgs->Add(m_textTitle, wxSizerFlags().Expand().Border(wxBOTTOM));
+
     sizerMsgs->Add(new wxStaticText(this, wxID_ANY, "&Main message:"));
     m_textMsg = new wxTextCtrl(this, wxID_ANY, "Hello from a box!",
                                wxDefaultPosition, wxDefaultSize,
@@ -3139,7 +3143,7 @@ void TestMessageBoxDialog::PrepareMessageDialog(wxMessageDialogBase &dlg)
 
 void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
 {
-    wxMessageDialog dlg(this, GetMessage(), "Test Message Box", GetStyle());
+    wxMessageDialog dlg(this, GetMessage(), GetTitle(), GetStyle());
     PrepareMessageDialog(dlg);
 
     wxString btnName;
@@ -3227,8 +3231,7 @@ void TestRichMessageDialog::AddAdditionalFlags(wxSizer *sizer)
 
 void TestRichMessageDialog::OnApply(wxCommandEvent& WXUNUSED(event))
 {
-    wxRichMessageDialog dlg(this, GetMessage(), "Test Rich Message Dialog",
-                            GetStyle());
+    wxRichMessageDialog dlg(this, GetMessage(), GetTitle(), GetStyle());
     PrepareMessageDialog(dlg);
 
     dlg.ShowCheckBox(m_textCheckBox->GetValue(),
index bfc8fa086f2dd9c746076e87dbf853701dcb35fa..68dc77d2a4724299d3f4a8b01199e5cc85f5d39b 100644 (file)
@@ -208,6 +208,7 @@ public:
     bool Create();
 
 protected:
+    wxString GetTitle() { return m_textTitle->GetValue(); }
     wxString GetMessage() { return m_textMsg->GetValue(); }
     long GetStyle();
 
@@ -251,7 +252,8 @@ private:
         MsgDlgIcon_Max
     };
 
-    wxTextCtrl *m_textMsg,
+    wxTextCtrl *m_textTitle,
+               *m_textMsg,
                *m_textExtMsg;
 
     wxCheckBox *m_buttons[Btn_Max];