Correct examples in wxStaticBox(Sizer) documentation.

Added missing wxID_ANY in the control creation calls.

Also rephrase/extend the discussion about creating windows shown inside the
static box as its children or siblings.

Closes #11086.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-08-07 12:39:41 +00:00
parent f0f03f3242
commit 338c3ec73a
2 changed files with 42 additions and 25 deletions

View File

@@ -1647,25 +1647,29 @@ public:
/**
@class wxStaticBoxSizer
wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static box around
wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static box around
the sizer.
The static box may be either created independently or the sizer may create it
The static box may be either created independently or the sizer may create it
itself as a convenience. In any case, the sizer owns the wxStaticBox control
and will delete it in the wxStaticBoxSizer destructor.
Note that since wxWidgets 2.9.0 you are encouraged to build the windows which are
placed inside wxStaticBoxes as children of the wxStaticBox itself:
Note that since wxWidgets 2.9.1 you are encouraged to create the windows
which are added to wxStaticBoxSizer as children of wxStaticBox itself, see
this class documentation for more details.
Example of use of this class:
@code
...
wxStaticBoxSizer *sz = new wxStaticBoxSizer(wxVERTICAL, parentWindow, "StaticBox");
sz->Add(new wxStaticText(sz->GetStaticBox(), "This window is a child of the staticbox"));
...
void MyFrame::CreateControls()
{
wxPanel *panel = new wxPanel(this);
...
wxStaticBoxSizer *sz = new wxStaticBoxSizer(wxVERTICAL, panel, "Box");
sz->Add(new wxStaticText(sz->GetStaticBox(), wxID_ANY,
"This window is a child of the staticbox"));
...
}
@endcode
Creating the windows which are placed inside wxStaticBoxes as siblings of the
wxStaticBox is still allowed but it's deprecated as it gives some problems
(e.g. relative to tooltips) on some ports.
@library{wxcore}
@category{winlayout}