On Sun, 10 Dec 2017 18:06:18 +0000 jon bird wrote:
jb> During startup, I'm now getting an assertion failure:
jb>
jb> ... assert "traits" failed in wxStandardPathsBase::Get(): create wxApp
jb> before calling this
jb>
jb> This is being triggered by a call to
jb> wxStandardPaths::Get().GetExecutablePath() invoked as part of the main
jb> windows's OnInit call. This wasn't happening with 3.02
This is rather surprising, considering that this assert was added in
81f9c575047d54b1a5feb28b9d16ed1ce1eeb9b6 12.5 years ago, i.e. it was even
in 2.8, let alone 3.0. I can't really explain why hadn't you been getting
it before...
jb> (it still yields the correct answer though even under 3.1).
Yes, there is no problem with doing this under MSW or Unix, but it would
silently fail to work correctly in GUI applications under OS X if you call
it before the application object creation because it would use the standard
Unix/POSIX implementation there instead of the CoreFoundation-based one
which is only available via wxApp.
jb> It seems clear that it's not happy with this call being made this early
jb> on in the initialisation process but bearing in mind this is the Init
jb> call from wxApp and I want to retrieve this information as part of my
jb> app initialisation how is this addressed?
By the time YourApp::OnInit() is called, wxTheApp is already set, so there
should be no problem with using wxStandardPaths from it. Please try to
provide SSCCE of the problem, I tried reproducing it with:
---------------------------------- >8 --------------------------------------
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/stdpaths.h>
class MyFrame : public wxFrame
{
public:
MyFrame()
: wxFrame(NULL, wxID_ANY, wxStandardPaths::Get().GetExecutablePath())
{
}
};
class MyApp : public wxApp
{
public:
virtual bool OnInit() wxOVERRIDE
{
(new MyFrame)->Show();
return true;
}
virtual int OnExit() wxOVERRIDE { return 0; }
};
wxIMPLEMENT_APP(MyApp);
---------------------------------- >8 --------------------------------------
but it worked just fine for me.
jb> wxGenericStaticBitmap::SetScaleMode, this is a new call in 3.1 however
jb> it doesn't appear to do anything under Windows ie. whatever I pass to
jb> the routine has the same effect as if it were Scale_None.
I'm not sure what do you expect it to do, in particular please note that
this has nothing to do with DPI. From looking at the code, it looks like it
ought to do what it's documented to do, i.e. resize the bitmap when the
control is resized. If it doesn't work for you, an example or a patch to
the (static page of the) widgets sample would again be welcome.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/