Runtime errors with PNG, GIF, XPM bitmaps

Post here wxCrafter related issues / features / bugs
smitchell
CodeLite Curious
Posts: 6
Joined: Mon Jun 10, 2013 4:55 am
Genuine User: Yes
IDE Question: C++
Contact:

Runtime errors with PNG, GIF, XPM bitmaps

Post by smitchell »

First, thanks for developing a great IDE & wxCrafter!
I'm using 5.1 with wxCrafter 1.1 (registered), on Win7-x64 machine, (codelite-5.1.0-mingw4.7.1-wx2.9.4.exe bundle).

Currently I am experiencing a problem with images associated with wxToolbook pages (and probably other places too).
If I add XPM, GIF, or PNG 16x16 image files to the wxToolbook page toolbar (through "Control Specific Settings"),
they look fine in preview and the code generation completes OK, and the program compiles OK.

When I run the program I get an assert from wxWidgets:
../../src/msw/dib.cpp(140): assert "hbmp" failed in Create():
wxDIB::Create(): invalid bitmap

Pressing Cancel, then leads to another error message box:
"Couldn't add an image to the image list.
Details >>
> Unknown image data format
> XRC error: cannot create bitmap from "gui_dbgentech_bitmaps.cpp$....image_file.gif
> Couldn't add an image to the image list."

If I use 16x16 BMP image files, then I don't see the errors and the graphics display correctly.

Is there something in my configuration that might cause this?

Thanks,
-Stan
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Runtime errors with PNG, GIF, XPM bitmaps

Post by eranif »

It seems like you did not add the proper image handler

If you use PNG or any other format, you should make sure you add the proper handlers to wxImage
In your wxApp derived class, add these lines in the OnInit() function:

Code: Select all

// Add the common image handlers
wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxJPEGHandler );
wxImage::AddHandler( new wxGIFHandler );
Eran
Make sure you have read the HOW TO POST thread
smitchell
CodeLite Curious
Posts: 6
Joined: Mon Jun 10, 2013 4:55 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Runtime errors with PNG, GIF, XPM bitmaps

Post by smitchell »

Thanks, that was it.
I used wxInitAllImageHandlers() from OnInit() to get all image types the library supports.
-Stan
Post Reply