Using the latest nightly build of wxFormBuilder 3.4.2 from 2014-05-26 I have a wxFrame containing a wxStaticBoxSizer containing a wxTextCtrl. The code generated uses the frame as the parent for both the wxStaticBox and the wxTextCtrl, for example:
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Free form text (still converts \\xNN etc)") ), wxHORIZONTAL );
m_ctlFreeForm = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
This should be OK, although it is deprecated for wxWidgets 2.9+. There is also a bug in wxWidgets 2.9+ (see http://trac.wxwidgets.org/ticket/12369) that means this older style of parent has graphical problems.
Would it be possible for wxFormBuilder to generate code that uses the wxStaticBox as the parent of its children? For example:
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Free form text (still converts \\xNN etc)") ), wxHORIZONTAL );
m_ctlFreeForm = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
This can be implemented by modifying TemplateParser::ParseWxParent(). I've attached a patch with my solution (patch for SVN trunk revision 2188).
I tested it for C++ only. I suppose that for the generated code in PHP and Python be corrent you need wxStaticBoxSizer variable be a class member (permission should not be "none").
I suppose there can be a better solution but it might require modifying code generator too much.