diff --git a/contrib/src/xml/xh_panel.cpp b/contrib/src/xml/xh_panel.cpp index 4e327e7b34..cc4cff021a 100644 --- a/contrib/src/xml/xh_panel.cpp +++ b/contrib/src/xml/xh_panel.cpp @@ -36,7 +36,16 @@ wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler() wxObject *wxPanelXmlHandler::DoCreateResource() { - wxPanel *panel = new wxPanel(m_ParentAsWindow, + wxPanel *panel = wxDynamicCast(m_Instance, wxPanel); + + if (panel == NULL) + panel = new wxPanel(m_ParentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(_T("style"), 0), + GetName()); + else + panel->Create(m_ParentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(_T("style"), 0), diff --git a/contrib/src/xml/xmlres.cpp b/contrib/src/xml/xmlres.cpp index ee8299df4b..c2021c48ab 100644 --- a/contrib/src/xml/xmlres.cpp +++ b/contrib/src/xml/xmlres.cpp @@ -167,10 +167,7 @@ bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name) { - wxPanel *panel = new wxPanel; - if (!LoadPanel(panel, parent, name)) - { delete panel; return NULL; } - else return panel; + return (wxPanel*)CreateResFromNode(FindResource(name, wxT("panel")), parent, NULL); } bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name)