I'm trying to add a custom control to an xml-defined dialog. I'm using
this code snipplet in the xml file:
[ ... ]
<object class="sizeritem">
<object class="unknown" name="foobar">
</object>
</object>
[ ... ]
After reading the dialog from the xml file via wxxrc, how do I add the
custom control to the widget tree ? By the way, is there a documentation
or faq for wxxrc ? The readme in contrib/src/xrc is somewhat outdated...
Bye,
--
Viele Menschen sind zu gut erzogen, um mit vollem Mund zu
sprechen; aber sie haben keine Bedenken, dies mit leerem
Kopf zu tun. (Orson Welles)
Axel Schlueter wrote:
> I'm trying to add a custom control to an xml-defined dialog. I'm
> using this code snipplet in the xml file:
>
> [ ... ]
> <object class="sizeritem">
> <object class="unknown" name="foobar">
> </object>
> </object>
> [ ... ]
>
> After reading the dialog from the xml file via wxxrc, how do I add
> the custom control to the widget tree ?
Use AttachUnknownControl:
PreferencesDialog::PreferencesDialog(wxWindow *parent)
{
wxTheXmlResource->LoadDialog(this, parent, _T("preferences"));
wxTheXmlResource->AttachUnknownControl(_T("tm_langs"),
new wxEditableListBox(this, -1, _("My Languages")));
}
This is relatively new stuff, so make sure you have post-2.3.1
version of XRC, preferably fetched from CVS trunk. (Older versions
had broken "unknown" support that didn't work at all.) You may call
AttachUnknownControl anytime, not neccessary immediately after
LoadDialog.
> By the way, is there a
> documentation or faq for wxxrc ? The readme in contrib/src/xrc is
> somewhat outdated...
No, unfortunately not yet. The best sources are, for now
- files generated by wxrcedit, XRCEd or wxDesigner
- poEdit, an application that uses XRC (http://poedit.sf.net)
- XRC sources
- this mailing list archive
Roughly in this order.
There *will* be a manual, I promise. The ultimate question is, when :(
Regards,
Vasek