wxUiEditor
wxUiEditor copied to clipboard
wxWindow::FromDip() results in wxWidgets ASSERT if no window has been created
Description:
Calling wxWindow::FromDIP()
in wxFrame::Create()
before any application window has been created will result in an Assert in wxWidgets. A possible alternative would be to generate:
if (!wxFrame::Create(parent, id, title, wxDefaultPosition, wxDefaultSize, style, name))
return false;
if (pos != wxDefaultPosition || size != wxDefaultSize)
SetSize(FromDIP(pos).x, FromDIP(pos).y, FromDIP(size).x, FromDIP(size).y, wxSIZE_USE_EXISTING);
Note that wxWidgets lacks a SetSize(wxPoint, wxSize, ...) method, forcing us to call FromDip() four times instead of twice.
I have tested this in wxUiEditor which has a non-default size for the main window, and while it doesn't assert, I don't know if it actually works since it then restores the previous position/size. Needs further testing to verify that it works as expected.
Note: this will probably be a problem with an app that uses a dialog instead of a main window.