CComboBoxEx, CImageList, missing images
Posted on 2002-06-19
I have CComboBoxEx with images stored in CImageList. In CImageList I have one image for one indicated state of combobox item - each combobox item should have one and only image all the time the comboboxex is displayed.
But when I SW_SHOW this comboboxex (normally it is hidden, I show it just in case it is needed - I empty it, fill with items, show, after selection hide), I see all images OK but the one tied to selected item. Selected item has no image at all - neither in drop down list, nor in edit portion of comboboxex.
Remark: when I tried to add CBEIF_SELECTEDIMAGE and fill in cbi.iSelectedImage member, it had the same behavior.
Thanks - any help would be welcome.
Code for adding items:
CComboBoxEx* pCtrl = (CComboBoxEx*)pWnd;
for (int i = 0; i < arrCislo.GetSize(); i++)
sItem = arrCislo.GetAt(i).m_sText;
cbi.mask = CBEIF_IMAGE | CBEIF_TEXT; // CBEIF_SELECTEDIMAGE
cbi.iItem = i;
cbi.pszText = (LPTSTR)(LPCTSTR)sItem;
cbi.cchTextMax = sItem.GetLength();
cbi.iImage = arrCislo.GetAt(i).m_nTypCD;
// cbi.iSelectedImage = 1;
nIndex = pCtrl->InsertItem(&cbi);
if (nIndex == LB_ERR) break;
pMstCislo = new tstMstCislo;
*pMstCislo = arrCislo.GetAt(i);