I had a very annoying bug that is solved and I just wanted to document it here in case it happens to someone.
I was just trying to use some XPM icons for a treeCtrl as I did in a previous project. In short the code used :
myFrame.h :
Code: Select all
#include "wx/imaglist.h"
#include "icons/iconID.xpm"
#include "icons/iconIF.xpm"
#include "icons/iconAPP.xpm"
Code: Select all
MyFrame::MyFrame() : wxFrame(...)
{
SetIcon(iconapp_xpm);
createImageList();
...
}
void MyFrame::createImageList() {
wxImageList* images = new wxImageList(16, 16, true);
wxBusyCursor wait;
images->Add(wxIcon(iconid_xpm));
images->Add(wxIcon(iconif_xpm));
ifTreeViewer->AssignImageList(images);
}
So after a lot of useless research, I found that the problem was the icon I generated using "Junior Icon Editor". I tried to reuse some other icons and the code was fine. Looking at the xpm code :SetIcon error : no suitable constructor exist to convert from "const unsigned char *[39] to "wxIcon"
wxIcon error : no instance of constructor "wxIcon::wxIcon" matches the argument list argument types are: (const unsigned char *[39])
Non working XPM icon :
Code: Select all
/* XPM */
static const unsigned char * iconid_xpm[] = {...
Code: Select all
/* XPM */
static const char *const iconidnok_xpm[] = {...