- Also, please note that because of this, the order in which you create new
- controls is important. Create your wxStaticBox control @b before any
- siblings that are to appear inside the wxStaticBox in order to preserve the
- correct Z-Order of controls.
+ So the new recommended way to create static box is:
+ @code
+ void MyFrame::CreateControls()
+ {
+ wxPanel *panel = new wxPanel(this);
+ wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
+
+ new wxStaticText(box, wxID_ANY "This window is a child of the staticbox");
+ ...
+ }
+ @endcode
+
+ While the compatible -- and now deprecated -- way is
+ @code
+ wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
+
+ new wxStaticText(panel, wxID_ANY "This window is a child of the panel");
+ ...
+ @endcode
+
+ Also note that there is a specialized wxSizer class (wxStaticBoxSizer) which can
+ be used as an easier way to pack items into a static box.