Hi, Wrote a little add-on (or two) to LoadFromString in Python. (Should
generalize to C++.) Looking for feedback, offer to contribute.
drawnread() loads a Window from an XRC file. Returns a container of
controls. Can be used:
conts= drawnread( filen, "MyFrame1" )
conts.MyFrame1.Show()
conts.m_button11.SetDefault()
conts['m_button11'].SetDefault()
Equivalent to map<wxString,wxWindow*>. Also loads Sizer instances by name
if possible:
contsC.bSizer13.Prepend( tree, 0, wx.EXPAND|wx.ALL )
XRC file generated with wxFormBuilder; custom build stores a 'name'
attribute with Sizer objects to facilitate.
Continuing from wxWidgets Disc. Forum, subj. Named Sizers. User 'Jorg'
says, "It looks very nice but I think your contribution is better on it's
place on the wxPython mailing list, where Robin or any other of the core
developers can give you feedback about it." So, hello.
Implementation of drawnread only shown here, full suite 200+ lines,
including @drbind() function wrapper and controlarray() function.
Of any interest?
TYAS, Aaron Brady.
def drawnread( filen, fraclass ):
'''load frame from XRC file named filen. children are accessible
in conts['controlname'] and conts.controlname'''
filetext= open( filen ).read()
res= xrc.XmlResource.Get()
res.LoadFromString( filetext )
fra= res.LoadFrame( None, fraclass )
conts= Conts()
addkids( conts, fra )
namesizers( conts, fra, fraclass, filen )
return conts