Version: 2.9.4
Public Member Functions
wxStaticBox Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/statbox.h>

Inheritance diagram for wxStaticBox:

Detailed Description

A static box is a rectangle drawn around other windows to denote a logical grouping of items.

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:

        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");
            ...
        }

While the compatible -- and now deprecated -- way is

            wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");

            new wxStaticText(panel, wxID_ANY "This window is a child of the panel");
            ...

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.

Library:  wxCore
Category:  Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance
参照:
wxStaticText, wxStaticBoxSizer

Public Member Functions

 wxStaticBox ()
 Default constructor.
 wxStaticBox (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticBoxNameStr)
 Constructor, creating and showing a static box.
virtual ~wxStaticBox ()
 Destructor, destroying the group box.
bool Create (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticBoxNameStr)
 Creates the static box for two-step construction.

List of all members.


Constructor & Destructor Documentation

wxStaticBox::wxStaticBox ( )

Default constructor.

wxStaticBox::wxStaticBox ( wxWindow parent,
wxWindowID  id,
const wxString label,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = 0,
const wxString name = wxStaticBoxNameStr 
)

Constructor, creating and showing a static box.

Parameters:
parentParent window. Must not be NULL.
idWindow identifier. The value wxID_ANY indicates a default value.
labelText to be displayed in the static box, the empty string for no label.
posWindow position. If wxDefaultPosition is specified then a default position is chosen.
sizeCheckbox size. If wxDefaultSize is specified then a default size is chosen.
styleWindow style. See wxStaticBox.
nameWindow name.
参照:
Create()
virtual wxStaticBox::~wxStaticBox ( ) [virtual]

Destructor, destroying the group box.


Member Function Documentation

bool wxStaticBox::Create ( wxWindow parent,
wxWindowID  id,
const wxString label,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = 0,
const wxString name = wxStaticBoxNameStr 
)

Creates the static box for two-step construction.

See wxStaticBox() for further details.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines