Tool bar icon problem
Posted: Thu Nov 30, 2017 12:09 am
Running wxCrafter 2.7 with wxWidgets 3.1.0 & MSVC 2015 under Win 10 64-bit
Recently I added some new icons from the crystal set to my app.
The icons are part of a tool bar in a dialog, in case it make any difference.
One set of PNG images loads and displays OK, the other does not.
I have asked on the wxWidgets forum and the issue seems to relate to the use of wxXmlResource to load the images.
The topic URL is https://forums.wxwidgets.org/viewtopic. ... 37#p180737
The images which cause issues are 'different' in that they are bigger than the ones which do not cause an issue.
I'll attach one copy of either set.
The main reason I am posting here is because I do not know or understand how the PNG files are translated to XML file and thus am unable to decide where to look for a solution to the problem.
The error comes when the last statement ->Realize() is executed, in the loop to display the button image, as soon as it tries to load the bit map, bmp.IsOK() fails.
The first clause, which loads the file directly, works, the code in the #else clause fails, even though they both load the same file.
And both files pass the test using pngcheck.
Recently I added some new icons from the crystal set to my app.
The icons are part of a tool bar in a dialog, in case it make any difference.
One set of PNG images loads and displays OK, the other does not.
I have asked on the wxWidgets forum and the issue seems to relate to the use of wxXmlResource to load the images.
The topic URL is https://forums.wxwidgets.org/viewtopic. ... 37#p180737
The images which cause issues are 'different' in that they are bigger than the ones which do not cause an issue.
I'll attach one copy of either set.
The main reason I am posting here is because I do not know or understand how the PNG files are translated to XML file and thus am unable to decide where to look for a solution to the problem.
Code: Select all
#if 0
wxBitmap wbmTest;
wbmTest.LoadFile( _("D:/pkg/wx/MSVC2015/_3.1-2015/wxGTM/rc/edit_add.png"),wxBITMAP_TYPE_PNG );
bool bIsOK = wbmTest.IsOk();
m_toolbarTemplate->AddTool(wxID_ANY, _("Add a row"), wbmTest, wxNullBitmap, wxITEM_NORMAL, _("Add/append a new row"), _("Add/append a new row"), NULL);
#else
m_toolbarTemplate->AddTool(wxID_ANY, _("Add a row"), wxXmlResource::Get()->LoadBitmap(wxT("edit_add")), wxNullBitmap, wxITEM_NORMAL, _("Add/append a new row"), _("Add/append a new row"), NULL);
.....
#endif
m_toolbarTemplate->Realize();
The first clause, which loads the file directly, works, the code in the #else clause fails, even though they both load the same file.
And both files pass the test using pngcheck.