---
name: "wxToggleButton"
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/wxToggleButton"
---

# wxToggleButton(3erl)

Functions for wxToggleButton class

## NAME

wxToggleButton - Functions for wxToggleButton class

## DESCRIPTION

*wxToggleButton* is a button that stays pressed when clicked by the user. In other words, it is similar to *wxCheckBox* in functionality but looks like a *wxButton*.

Since wxWidgets version 2.9.0 this control emits an update UI event.

You can see *wxToggleButton* in action in page\_samples\_widgets.

See: *wxCheckBox*, *wxButton*, *wxBitmapToggleButton* (not implemented in wx)

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

wxWidgets docs: wxToggleButton

## EVENTS

Event types emitted from this class: *command\_togglebutton\_clicked*

## DATA TYPES

```
wxToggleButton() = wx:wx_object()
```

## EXPORTS

```
new() -> wxToggleButton()
```

Default constructor.

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

Types:

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

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

Types:

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

Constructor, creating and showing a toggle button.

See: *create/5*, *wxValidator* (not implemented in wx)

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

Destructor, destroying the toggle button.

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

Types:

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

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

Types:

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

Creates the toggle button for two-step construction.

See *new/4* for details.

```
getValue(This) -> boolean()
```

Types:

This = wxToggleButton()\

Gets the state of the toggle button.

Return: Returns true if it is pressed, false otherwise.

```
setValue(This, State) -> ok
```

Types:

This = wxToggleButton()\
 State = boolean()\

Sets the toggle button to the given state.

This does not cause a *EVT\_TOGGLEBUTTON* event to be emitted.
