---
name: "wxStaticBox"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/wxStaticBox"
---

# wxStaticBox(3erl)

Functions for wxStaticBox class

## NAME

wxStaticBox - Functions for wxStaticBox class

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

While the compatible - and now deprecated - way is

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.

See: *wxStaticText*, *wxStaticBoxSizer*

This class is derived (and can use functions) from: *wxControl* *wxWindow* *wxEvtHandler*

wxWidgets docs: wxStaticBox

## DATA TYPES

```
wxStaticBox() = wx:wx_object()
```

## EXPORTS

```
new() -> wxStaticBox()
```

Default constructor.

```
new(Parent, Id, Label) -> wxStaticBox()
```

Types:

Parent = wxWindow:wxWindow()\
 Id = integer()\
 Label = unicode:chardata()\

```
new(Parent, Id, Label, Options :: [Option]) -> wxStaticBox()
```

Types:

Parent = wxWindow:wxWindow()\
 Id = integer()\
 Label = unicode:chardata()\
 Option = \
\
     {pos, {X :: integer(), Y :: integer()}} \|\
\
     {size, {W :: integer(), H :: integer()}} \|\
\
     {style, integer()}\

Constructor, creating and showing a static box.

See: *create/5*

```
destroy(This :: wxStaticBox()) -> ok
```

Constructor for a static box using the given window as label.

This constructor takes a pointer to an arbitrary window (although usually a *wxCheckBox* or a *wxRadioButton*) instead of just the usual text label and puts this window at the top of the box at the place where the label would be shown.

The *label* window must be a non-null, fully created window and will become a child of this *wxStaticBox*, i.e. it will be owned by this control and will be deleted when the *wxStaticBox* itself is deleted.

An example of creating a *wxStaticBox* with window as a label:

Currently this constructor is only available in wxGTK and wxMSW, use *wxHAS\_WINDOW\_LABEL\_IN\_STATIC\_BOX* to check whether it can be used at compile-time.

Since: 3.1.1 Destructor, destroying the group box.

```
create(This, Parent, Id, Label) -> boolean()
```

Types:

This = wxStaticBox()\
 Parent = wxWindow:wxWindow()\
 Id = integer()\
 Label = unicode:chardata()\

```
create(This, Parent, Id, Label, Options :: [Option]) -> boolean()
```

Types:

This = wxStaticBox()\
 Parent = wxWindow:wxWindow()\
 Id = integer()\
 Label = unicode:chardata()\
 Option = \
\
     {pos, {X :: integer(), Y :: integer()}} \|\
\
     {size, {W :: integer(), H :: integer()}} \|\
\
     {style, integer()}\

Creates the static box for two-step construction.

See *new/4* for further details.
