xrc.TheXmlResource is not unique

Hi,
it seems that xrc.TheXmlResource is not always a reference to the app's xml
resource. I'm loading an xrc file via an wxMemoryFileHandler which works fine.
Later in the app I want to load an additional panel, which will as page to a
wx.notebook, from xrc and that does not work if use the TheXmlResource as a
reference. Instead I have to use something like this: wx.GetApp().res.
Is that known/intended/a bug?
Regards, Christian

Christian Kristukat wrote:

Hi,
it seems that xrc.TheXmlResource is not always a reference to the app's xml
resource. I'm loading an xrc file via an wxMemoryFileHandler which works fine.
Later in the app I want to load an additional panel, which will as page to a
wx.notebook, from xrc and that does not work if use the TheXmlResource as a
reference. Instead I have to use something like this: wx.GetApp().res.
Is that known/intended/a bug?

Did you use xrc.TheXmlResource when you loaded the first set of xrc data, or did you create a new instance? If you created a new instance and did not pass it to xrc.XmlResource.Set() then it won't be the one returned from xrc.TheXmlResource. BTW, xrc.TheXmlResource is just a compatibility alias for xrc.XmlResource.Get()

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Christian Kristukat wrote:

Hi,
it seems that xrc.TheXmlResource is not always a reference to the
app's xml
resource. I'm loading an xrc file via an wxMemoryFileHandler which
works fine.
Later in the app I want to load an additional panel, which will as
page to a
wx.notebook, from xrc and that does not work if use the TheXmlResource
as a
reference. Instead I have to use something like this: wx.GetApp().res.
Is that known/intended/a bug?

Did you use xrc.TheXmlResource when you loaded the first set of xrc
data, or did you create a new instance? If you created a new instance

I created a new empty instance.

and did not pass it to xrc.XmlResource.Set() then it won't be the one
returned from xrc.TheXmlResource. BTW, xrc.TheXmlResource is just a
compatibility alias for xrc.XmlResource.Get()

I didn't know that. Thanks for the explanation. Am I right that this is not
documented anywhere?

Christian

Christian Kristukat wrote:

Robin Dunn wrote:

and did not pass it to xrc.XmlResource.Set() then it won't be the one
returned from xrc.TheXmlResource. BTW, xrc.TheXmlResource is just a
compatibility alias for xrc.XmlResource.Get()

I didn't know that. Thanks for the explanation. Am I right that this is not
documented anywhere?

Probably not. When wxTheXmlResource was deprecated it was probably removed from the docs.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!