fixed LoadPanel (created two instances previously and returned the wrong one)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-10-01 21:31:35 +00:00
parent 2d19ad2578
commit 63ee409315
2 changed files with 11 additions and 5 deletions

View File

@@ -36,7 +36,16 @@ wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler()
wxObject *wxPanelXmlHandler::DoCreateResource() 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(), GetID(),
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(_T("style"), 0), GetStyle(_T("style"), 0),

View File

@@ -167,10 +167,7 @@ bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString&
wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name) wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name)
{ {
wxPanel *panel = new wxPanel; return (wxPanel*)CreateResFromNode(FindResource(name, wxT("panel")), parent, NULL);
if (!LoadPanel(panel, parent, name))
{ delete panel; return NULL; }
else return panel;
} }
bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name) bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name)