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()
};
// ----------------------------------------------------------------------------
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
}
// 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,
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
n, choices,
style, pos,
- wxLB_ALWAYS_SB | wxLB_MULTIPLE) )
+ wxLB_ALWAYS_SB | wxLB_EXTENDED) )
return FALSE;
return TRUE;
}
}
-void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
+bool wxMultiChoiceDialog::TransferDataFromWindow()
{
m_selections.Empty();
size_t count = m_listbox->GetCount();
m_selections.Add(n);
}
- EndModal(wxID_OK);
+ return TRUE;
}