]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/wince/checklst.cpp
make sure we don't use uninitalized output stream in OnSysWrite() (coverity checked...
[wxWidgets.git] / src / msw / wince / checklst.cpp
index b7310d586f00238c6e4e1d7d366a8a24d3ee558b..56b519b537be2acc2b4e3c2fc479d9828e377ecb 100644 (file)
@@ -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);
     }
 }