Fix bug when resetting wxListCtrl column header image in wxMSW
Set LVCFMT_IMAGE, meaning that the column just uses an image from the image list, instead of LVCFMT_COL_HAS_IMAGES, meaning that the column contains the image from the image list and do not set LVCF_IMAGE when resetting the image, as this still reserved space for the (invalid) image, resulting in an extra blank area in the column header. Closes https://github.com/wxWidgets/wxWidgets/pull/1739 Closes #18617.
This commit is contained in:
@@ -3668,8 +3668,6 @@ static void wxConvertToMSWListCol(HWND hwndList,
|
|||||||
|
|
||||||
if ( item.m_mask & wxLIST_MASK_IMAGE )
|
if ( item.m_mask & wxLIST_MASK_IMAGE )
|
||||||
{
|
{
|
||||||
lvCol.mask |= LVCF_IMAGE;
|
|
||||||
|
|
||||||
// as we're going to overwrite the format field, get its
|
// as we're going to overwrite the format field, get its
|
||||||
// current value first -- unless we want to overwrite it anyhow
|
// current value first -- unless we want to overwrite it anyhow
|
||||||
if ( !(lvCol.mask & LVCF_FMT) )
|
if ( !(lvCol.mask & LVCF_FMT) )
|
||||||
@@ -3689,14 +3687,18 @@ static void wxConvertToMSWListCol(HWND hwndList,
|
|||||||
// seem to be generally nicer than on the left and the generic
|
// seem to be generally nicer than on the left and the generic
|
||||||
// version only draws them on the right (we don't have a flag to
|
// version only draws them on the right (we don't have a flag to
|
||||||
// specify the image location anyhow)
|
// specify the image location anyhow)
|
||||||
const int fmtImage = LVCFMT_BITMAP_ON_RIGHT | LVCFMT_COL_HAS_IMAGES;
|
const int fmtImage = LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE;
|
||||||
|
|
||||||
if ( item.m_image != -1 )
|
if ( item.m_image != -1 )
|
||||||
|
{
|
||||||
lvCol.fmt |= fmtImage;
|
lvCol.fmt |= fmtImage;
|
||||||
else // remove any existing image
|
|
||||||
lvCol.fmt &= ~fmtImage;
|
|
||||||
|
|
||||||
lvCol.iImage = item.m_image;
|
lvCol.mask |= LVCF_IMAGE;
|
||||||
|
lvCol.iImage = item.m_image;
|
||||||
|
}
|
||||||
|
else // remove any existing image
|
||||||
|
{
|
||||||
|
lvCol.fmt &= ~fmtImage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user