fixed multiple bugs in multiple selection wxCheckListBoxes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-05-05 23:09:37 +00:00
parent 98dd66cf4f
commit d90879fa39
4 changed files with 125 additions and 40 deletions

View File

@@ -453,21 +453,32 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
if ( HasMultipleSelection() )
{
int no_sel = ListBox_GetSelCount(GetHwnd());
if (no_sel != 0) {
int *selections = new int[no_sel];
int rc = ListBox_GetSelItems(GetHwnd(), no_sel, selections);
int countSel = ListBox_GetSelCount(GetHwnd());
if ( countSel == LB_ERR )
{
wxLogDebug(_T("ListBox_GetSelCount failed"));
}
else if ( countSel != 0 )
{
int *selections = new int[countSel];
wxCHECK_MSG(rc != LB_ERR, -1, wxT("ListBox_GetSelItems failed"));
aSelections.Alloc(no_sel);
for ( int n = 0; n < no_sel; n++ )
aSelections.Add(selections[n]);
if ( ListBox_GetSelItems(GetHwnd(),
countSel, selections) == LB_ERR )
{
wxLogDebug(wxT("ListBox_GetSelItems failed"));
countSel = -1;
}
else
{
aSelections.Alloc(countSel);
for ( int n = 0; n < countSel; n++ )
aSelections.Add(selections[n]);
}
delete [] selections;
}
return no_sel;
return countSel;
}
else // single-selection listbox
{