]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed LoadPanel (created two instances previously and returned the wrong one)
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 1 Oct 2000 21:31:35 +0000 (21:31 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 1 Oct 2000 21:31:35 +0000 (21:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/xml/xh_panel.cpp
contrib/src/xml/xmlres.cpp

index 4e327e7b34ac80ebf3bd51fa959f3ebad5762644..cc4cff021a1a74914f6e7b535f731bbc08ba2f72 100644 (file)
@@ -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),
index ee8299df4b6290bf5df23d6d92dfcfb51a967be2..c2021c48aba89cfdae898efd7b901d046c03a0dd 100644 (file)
@@ -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)