From 5d987909a83e885eca7bd281c912dfb522a0e074 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 20 Aug 2001 23:01:17 +0000 Subject: [PATCH] moved button handler into the modeless dialog itself - at least like this it works git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dialogs/dialogs.cpp | 16 ++++++++-------- samples/dialogs/dialogs.h | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 84ea95b342..0e04f3effa 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -91,8 +91,6 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_FIND_CLOSE(-1, MyFrame::OnFindDialog) #endif // wxUSE_FINDREPLDLG EVT_MENU(wxID_EXIT, MyFrame::OnExit) - - EVT_BUTTON(DIALOGS_MODELESS_BTN, MyFrame::OnButton) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyModalDialog, wxDialog) @@ -100,6 +98,8 @@ BEGIN_EVENT_TABLE(MyModalDialog, wxDialog) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MyModelessDialog, wxDialog) + EVT_BUTTON(DIALOGS_MODELESS_BTN, MyModelessDialog::OnButton) + EVT_CLOSE(MyModelessDialog::OnClose) END_EVENT_TABLE() @@ -548,12 +548,6 @@ void MyFrame::ModelessDlg(wxCommandEvent& event) } } -void MyFrame::OnButton(wxCommandEvent& WXUNUSED(event)) -{ - wxMessageBox("Button pressed in modeless dialog", "Info", - wxOK | wxICON_INFORMATION, this); -} - void MyFrame::ShowTip(wxCommandEvent& event) { #if wxUSE_STARTUP_TIPS @@ -742,6 +736,12 @@ MyModelessDialog::MyModelessDialog(wxWindow *parent) sizerTop->Fit(this); } +void MyModelessDialog::OnButton(wxCommandEvent& WXUNUSED(event)) +{ + wxMessageBox("Button pressed in modeless dialog", "Info", + wxOK | wxICON_INFORMATION, this); +} + void MyModelessDialog::OnClose(wxCloseEvent& event) { if ( event.CanVeto() ) diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index ccf3da8b7d..ccd0c20183 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -28,6 +28,7 @@ class MyModelessDialog : public wxDialog public: MyModelessDialog(wxWindow *parent); + void OnButton(wxCommandEvent& event); void OnClose(wxCloseEvent& event); private: @@ -91,8 +92,6 @@ public: void OnExit(wxCommandEvent& event); - void OnButton(wxCommandEvent& event); - private: MyModelessDialog *m_dialog; -- 2.45.2