X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39cdc95fb3819c4b4ed4c41d51dfd770ce5363eb..575821fad84c6f60602ffce6f8f6e727247ce651:/interface/wx/statbox.h diff --git a/interface/wx/statbox.h b/interface/wx/statbox.h index ff31baeeb4..d10a693c12 100644 --- a/interface/wx/statbox.h +++ b/interface/wx/statbox.h @@ -3,7 +3,7 @@ // Purpose: interface of wxStaticBox // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -12,20 +12,33 @@ A static box is a rectangle drawn around other windows to denote a logical grouping of items. - 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 while the previous versions required that windows appearing + inside a static box be created as its siblings (i.e. use the same parent as + the static box itself), since wxWidgets 2.9.1 it is also possible to create + them as children of wxStaticBox itself and you are actually encouraged to + do it like this if compatibility with the previous versions is not + important. + + 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 *stbox = new wxStaticBox(parentWindow, wxID_ANY, "StaticBox"); + wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); - new wxStaticText(stbox, "This window is a child of the staticbox"); - ... + new wxStaticText(panel, wxID_ANY "This window is a child of the panel"); + ... @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. - + 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.