diff --git a/docs/changes.txt b/docs/changes.txt index cfe97ea217..1b45e3c7fc 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -576,6 +576,7 @@ wxMSW: - It is now possible to tab into radio boxes again. - Fix launching some types of files under Windows 7 and later (Steven Houchins). +- Don't use an icon for items inserted without one into wxListCtrl (Chuddah). wxOSX: diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 97388cd847..4ffa6e596d 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -952,7 +952,7 @@ bool wxListCtrl::SetItemColumnImage(long item, long column, int image) info.m_mask = wxLIST_MASK_IMAGE; info.m_image = image; - info.m_itemId = item; + info.m_itemId = item == -1 ? I_IMAGENONE : image; info.m_col = column; return SetItem(info); @@ -1751,11 +1751,9 @@ long wxListCtrl::InsertItem(long index, int imageIndex) long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) { wxListItem info; - info.m_image = imageIndex; + info.m_image = imageIndex == -1 ? I_IMAGENONE : imageIndex; info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - if (imageIndex > -1) - info.m_mask |= wxLIST_MASK_IMAGE; + info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE; info.m_itemId = index; return InsertItem(info); }