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
This commit is contained in:
@@ -164,14 +164,13 @@ public:
|
|||||||
wxArrayInt GetSelections() const { return m_selections; }
|
wxArrayInt GetSelections() const { return m_selections; }
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
void OnOK(wxCommandEvent& event);
|
virtual bool TransferDataFromWindow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxArrayInt m_selections;
|
wxArrayInt m_selections;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxMultiChoiceDialog)
|
DECLARE_DYNAMIC_CLASS(wxMultiChoiceDialog)
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -365,12 +365,14 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) )
|
|||||||
this);
|
this);
|
||||||
if ( count )
|
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++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
wxLogMessage("\t%u: %u (%s)", n, selections[n],
|
msg += wxString::Format("\t%u: %u (%s)\n", n, selections[n],
|
||||||
choices[selections[n]].c_str());
|
choices[selections[n]].c_str());
|
||||||
}
|
}
|
||||||
|
wxLogMessage(msg);
|
||||||
}
|
}
|
||||||
//else: cancelled or nothing selected
|
//else: cancelled or nothing selected
|
||||||
}
|
}
|
||||||
|
@@ -436,10 +436,6 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
|
|||||||
// wxMultiChoiceDialog
|
// wxMultiChoiceDialog
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxMultiChoiceDialog, wxDialog)
|
|
||||||
EVT_BUTTON(wxID_OK, wxMultiChoiceDialog::OnOK)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog)
|
||||||
|
|
||||||
bool wxMultiChoiceDialog::Create( wxWindow *parent,
|
bool wxMultiChoiceDialog::Create( wxWindow *parent,
|
||||||
@@ -453,7 +449,7 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent,
|
|||||||
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
|
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
|
||||||
n, choices,
|
n, choices,
|
||||||
style, pos,
|
style, pos,
|
||||||
wxLB_ALWAYS_SB | wxLB_MULTIPLE) )
|
wxLB_ALWAYS_SB | wxLB_EXTENDED) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -468,7 +464,7 @@ void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
bool wxMultiChoiceDialog::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
m_selections.Empty();
|
m_selections.Empty();
|
||||||
size_t count = m_listbox->GetCount();
|
size_t count = m_listbox->GetCount();
|
||||||
@@ -478,5 +474,5 @@ void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_selections.Add(n);
|
m_selections.Add(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user