mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-20 22:06:25 +08:00
Don't use first image for wxListCtrl items without any image
Native wxListCtrl in wxMSW behaved inconsistently with the generic one and used the first image for the new items inserted into it even if no image was explicitly specified. Work around this unhelpful native behaviour by using I_IMAGENONE for the items without images. Closes #26062.
This commit is contained in:
@@ -2066,6 +2066,16 @@ long wxListCtrl::InsertItem(const wxListItem& info)
|
||||
|
||||
LV_ITEM item;
|
||||
wxConvertToMSWListItem(this, info, item);
|
||||
|
||||
// When inserting items into a control with an image list, the first image
|
||||
// is used by default, so we need to explicitly specify that we don't want
|
||||
// any image if it wasn't set.
|
||||
if ( !(item.mask & LVIF_IMAGE) )
|
||||
{
|
||||
item.iImage = I_IMAGENONE;
|
||||
item.mask |= LVIF_IMAGE;
|
||||
}
|
||||
|
||||
item.mask &= ~LVIF_PARAM;
|
||||
|
||||
// check whether we need to allocate our internal data
|
||||
|
||||
Reference in New Issue
Block a user