# wxStaticBoxSizer Class Reference
[Window Layout]

`#include <wx/sizer.h>`

Inheritance diagram for wxStaticBoxSizer:
[legend]

## Detailed Description

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 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.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:

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

##

Library: wxCore

Category: Window Layout

See also:
  wxSizer, wxStaticBox, wxBoxSizer, Sizers Overview

## Public Member Functions
| wxStaticBoxSizer (wxStaticBox *box, int orient)
| This constructor uses an already existing static box.
| wxStaticBoxSizer (int orient, wxWindow *parent, const wxString &label=wxEmptyString)
| This constructor creates a new static box with the given label and parent window.
wxStaticBox * | GetStaticBox () const
| Returns the static box associated with the sizer.

List of all members.

## Constructor & Destructor Documentation

wxStaticBoxSizer::wxStaticBoxSizer | ( | wxStaticBox * | box,
|  | int | orient |
| ) |  |  |

This constructor uses an already existing static box.

Parameters:

  | box | The static box to associate with the sizer (which will take its ownership).
  | orient | Can be either `wxVERTICAL` or `wxHORIZONTAL`.

wxStaticBoxSizer::wxStaticBoxSizer | ( | int | orient,
|  | wxWindow * | parent,
|  | const wxString & | label = `wxEmptyString` |
| ) |  |  |

This constructor creates a new static box with the given label and parent window.

## Member Function Documentation

wxStaticBox* wxStaticBoxSizer::GetStaticBox | ( |  | ) | const

Returns the static box associated with the sizer.

|  | [ top ]