wxToggleButton — wx v2.4.2

Search documentation of wx

# View Source wxToggleButton (wx v2.4.2)

Functions for wxToggleButton class

`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`

# Summary

## Types

wxToggleButton()

## Functions

create(This, Parent, Id, Label)
create/5

Creates the toggle button for two-step construction.

destroy(This)

Destructor, destroying the toggle button.

getValue(This)

Gets the state of the toggle button.

new()

Default constructor.

new(Parent, Id, Label)
new/4

Constructor, creating and showing a toggle button.

setValue(This, State)

Sets the toggle button to the given state.

# Types

Link to this type

# wxToggleButton()

View Source

    -type wxToggleButton() :: wx:wx_object().

# Functions

Link to this function

# create(This, Parent, Id, Label)

View Source

    -spec create(This, Parent, Id, Label) -> boolean()
                    when
                        This :: wxToggleButton(),
                        Parent :: wxWindow:wxWindow(),
                        Id :: integer(),
                        Label :: unicode:chardata().

Link to this function

# create/5

View Source

    -spec create(This, Parent, Id, Label, [Option]) -> boolean()
                    when
                        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.

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxToggleButton()) -> ok.

Destructor, destroying the toggle button.

Link to this function

# getValue(This)

View Source

    -spec getValue(This) -> boolean() when This :: wxToggleButton().

Gets the state of the toggle button.

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

Link to this function

# new()

View Source

    -spec new() -> wxToggleButton().

Default constructor.

Link to this function

# new(Parent, Id, Label)

View Source

    -spec new(Parent, Id, Label) -> wxToggleButton()
                 when Parent :: wxWindow:wxWindow(), Id :: integer(), Label :: unicode:chardata().

Link to this function

# new/4

View Source

    -spec new(Parent, Id, Label, [Option]) -> wxToggleButton()
                 when
                     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)

Link to this function

# setValue(This, State)

View Source

    -spec setValue(This, State) -> ok when This :: wxToggleButton(), State :: boolean().

Sets the toggle button to the given state.

This does not cause a `EVT_TOGGLEBUTTON` event to be emitted.