]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed my previous fix in wxListCtrl::SetItem
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Aug 2000 10:39:33 +0000 (10:39 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Aug 2000 10:39:33 +0000 (10:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index 1481cda78cbc3ebe12c8b2dfc4183344ab4d1f78..8d58bde1da52ed60a5973e96ce9ef3dd2d0ecfca 100644 (file)
@@ -632,8 +632,11 @@ bool wxListCtrl::SetItem(wxListItem& info)
     // check whether it has any custom attributes
     if ( info.HasAttributes() )
     {
-        delete m_attrs.Delete(item.iItem); // remove existing attributes
-        m_attrs.Put(item.iItem, (wxObject *)new wxListItemAttr(*info.GetAttributes()));
+        wxListItemAttr *attr;
+        attr = (wxListItemAttr*) m_attrs.Get(item.iItem);
+        if (attr == NULL)
+            m_attrs.Put(item.iItem, (wxObject *)new wxListItemAttr(*info.GetAttributes()));
+        else *attr = *info.GetAttributes();
 
         m_hasAnyAttr = TRUE;
     }
@@ -1125,7 +1128,11 @@ long wxListCtrl::InsertItem(wxListItem& info)
     // check whether it has any custom attributes
     if ( info.HasAttributes() )
     {
-        m_attrs.Put(item.iItem, (wxObject *)new wxListItemAttr(*info.GetAttributes()));
+        wxListItemAttr *attr;
+        attr = (wxListItemAttr*) m_attrs.Get(item.iItem);
+        if (attr == NULL)
+            m_attrs.Put(item.iItem, (wxObject *)new wxListItemAttr(*info.GetAttributes()));
+        else *attr = *info.GetAttributes();
 
         m_hasAnyAttr = TRUE;
     }