Search code examples
wxwidgets

wxListCtrl does not show images


I make use of a wxListCtrl which has one column (so a really simple list). Based on the listctrl-sample I tried to have the list-items with a icon in front. Unfortunately only the text is shown but not the image.

That's my code (relevant parts only):

m_toolImages=new wxImageList(25,25);

m_hideList=new wxListCtrl(toolPanel,wxID_ANY,wxDefaultPosition,wxSize(180,-1),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL);
m_hideList->AppendColumn(wxEmptyString);
m_hideList->SetColumnWidth(0,250);
m_hideList->SetImageList(m_toolImages,wxIMAGE_LIST_NORMAL);

imageID=m_toolImages->Add(bm); // bm is a wxBitmap wit a size of 25x25 pixels

m_hideList->InsertItem(i,"ItemName",imageID);

So...what could be missing here?


Solution

  • The report mode uses "small" image list and not the normal one, which is only used in the "icon" mode, so you need to set that one.