views:

96

answers:

1

I've got an wx App that has the UI defined in XRC files. Each form is in its own xrc file. There is one panel that is common to many of the forms. Is there a way to have objects defined in one file that are included and referenced in another?

I know there is a object_ref mechanism, but I can't see how that can reference external xrc files.

I'd like something that worked similar to the way you can define xsd elements in one file and include and reference them in another xsd file.

+1  A: 

XRC doesn't have an include mechanism that I know of, but you can have custom widgets.

So implement your common panel as its own XRC, and set that up as something that you can reference by class name in other xrc files.

You would create an XmlResourceHandler that handles the custom Panel in the XRC, and instantiates your Panel class. The place to look is demo/wxXmlResourceHandler.py

You can even extend XRCed to recognize your own resource, and insert it into future dialogs with ease.

Jim Carroll