From: Vadim Zeitlin Date: Fri, 3 Nov 2000 21:11:41 +0000 (+0000) Subject: ok, it does work - it's just that wxGTK doesn't X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3d49ce4485af0c6ee498193519473cd8a830bbff ok, it does work - it's just that wxGTK doesn't git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index ff12c18d92..9bba7c06db 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -164,14 +164,13 @@ public: wxArrayInt GetSelections() const { return m_selections; } // implementation from now on - void OnOK(wxCommandEvent& event); + virtual bool TransferDataFromWindow(); protected: wxArrayInt m_selections; private: DECLARE_DYNAMIC_CLASS(wxMultiChoiceDialog) - DECLARE_EVENT_TABLE() }; // ---------------------------------------------------------------------------- diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index cafe3bdf22..f2d8a6ead2 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -365,12 +365,14 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) ) this); if ( count ) { - wxLogMessage("You selected %u items:", count); + wxString msg; + msg.Printf("You selected %u items:\n", count); for ( size_t n = 0; n < count; n++ ) { - wxLogMessage("\t%u: %u (%s)", n, selections[n], - choices[selections[n]].c_str()); + msg += wxString::Format("\t%u: %u (%s)\n", n, selections[n], + choices[selections[n]].c_str()); } + wxLogMessage(msg); } //else: cancelled or nothing selected } diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 62a5371f15..b99fe2057f 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -436,10 +436,6 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) // wxMultiChoiceDialog // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxMultiChoiceDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxMultiChoiceDialog::OnOK) -END_EVENT_TABLE() - IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog) bool wxMultiChoiceDialog::Create( wxWindow *parent, @@ -453,7 +449,7 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent, if ( !wxAnyChoiceDialog::Create(parent, message, caption, n, choices, style, pos, - wxLB_ALWAYS_SB | wxLB_MULTIPLE) ) + wxLB_ALWAYS_SB | wxLB_EXTENDED) ) return FALSE; return TRUE; @@ -468,7 +464,7 @@ void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) } } -void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) +bool wxMultiChoiceDialog::TransferDataFromWindow() { m_selections.Empty(); size_t count = m_listbox->GetCount(); @@ -478,5 +474,5 @@ void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) m_selections.Add(n); } - EndModal(wxID_OK); + return TRUE; }