From: Włodzimierz Skiba Date: Sun, 26 Feb 2006 02:00:46 +0000 (+0000) Subject: Correct wxCheckListBox insertion. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c5491b21d93690a81a77c038cf7c38c4984b160f Correct wxCheckListBox insertion. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/wince/checklst.cpp b/src/msw/wince/checklst.cpp index b7310d586f..56b519b537 100644 --- a/src/msw/wince/checklst.cpp +++ b/src/msw/wince/checklst.cpp @@ -286,9 +286,18 @@ wxClientData* wxCheckListBox::DoGetItemClientObject(int n) const void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) { + wxCHECK_RET( pos >= 0 && pos <= GetCount(), + wxT("invalid index in wxListBox::InsertItems") ); + for( size_t i = 0; i < items.GetCount(); i++ ) { - Insert(items[i],pos+i); + LVITEM newItem; + wxZeroMemory(newItem); + newItem.iItem = i+pos; + int ret = ListView_InsertItem( (HWND)GetHWND(), & newItem ); + wxASSERT_MSG( int(i+pos) == ret , _T("Item not added") ); + SetString( ret , items[i] ); + m_itemsClientData.Insert(NULL, ret); } }