Page 1 of 1

XRC error: Class "wxBitmap" not found

Posted: Wed Dec 28, 2016 11:03 pm
by iwbnwif
Hi,

CodeLite 9.2.8, Windows 10, wxCrafter 2.7 (licensed), wxWidgets latest from GitHub.

I have a project that has been working fine for ages until I made a small change to the text under a wxRibbonButtonBar button (and recompiled).

Now I receive run time asserts on all the icons in that particular wxRibbonButtonBar.

The following error is given:

Code: Select all

Error: XRC error: XRC resource "project-edit" (class "wxBitmap") not found
The assert occurs at line 300 of buttonbar.cpp:

Code: Select all

wxASSERT(bitmap.IsOk() || bitmap_small.IsOk());
The relevant line in the wxCrafter generated file is:

Code: Select all

m_ProjectButtonBar->AddButton(wxID_ANY, _("Edit Item"), wxXmlResource::Get()->LoadBitmap(wxT("project-edit")), _("Help String"), wxRIBBON_BUTTON_NORMAL);
Note: It is AddButton (calling InsertButton) that causes the assert, not the LoadBitmap call. Although the LoadBitmap may have failed.

And yet when I view the ribbon in wxCrafter everything appears to be normal. I have never used the XRC system manually and don't understand the mechanism so this has got me stumped.

I realise that the above is probably not enough information, so please could you let me know which files to look in to diagnose further.

Re: XRC error: Class "wxBitmap" not found

Posted: Wed Dec 28, 2016 11:22 pm
by eranif
Can you please provide the offending wxcp file?

Re: XRC error: Class "wxBitmap" not found

Posted: Thu Dec 29, 2016 12:26 am
by iwbnwif
Thank you for the super fast response.

I have done some digging in the wxcp file and it seems that the problem only occurs when 2 buttons have the ID as wxID_ANY. If I give each button a unique ID, then the problem goes away.

Is that normal behaviour? I will create a test wxcp if not and upload it.

Re: XRC error: Class "wxBitmap" not found

Posted: Thu Dec 29, 2016 12:47 am
by eranif
iwbnwif wrote:Is that normal behaviour? I will create a test wxcp if not and upload it.
No. This is not normal behaviour

[Solved] Re: XRC error: Class "wxBitmap" not found

Posted: Thu Dec 29, 2016 1:03 am
by iwbnwif
Hmm, so I changed the ID back to wxID_ANY and ... no assert.

Very strange, but I guess the wxcp file was corrupted in some way, or just out of sync with the .cpp file (I am using SVN).

Thank you for your help and pointer to the wxcp file.

Just in case anyone else sees the problem in future - I temporarily changed the ID of the tool that was asserting, recompiled the wxCrafter files and rebuilt the project.