wxToggleButton(3erl)

πŸ’… wxToggleButton (3erl) β€” Erlang Module Definition

okay so bestie, welcome to wxToggleButton β€” the Erlang module page for the wxToggleButton class, and honestly? it's giving "checkbox but make it fashion." let's get into it πŸŽ€


✨ DESCRIPTION ✨

wxToggleButton is a button that stays pressed when you click it. yes, that's the whole vibe. it's a button that commits. πŸ’–

in other words, it is similar to wxCheckBox in functionality but looks like a wxButton. so it does the checkbox thing but serves button looks. icon behavior, honestly.

since wxWidgets version 2.9.0 this control emits an update UI event. periodt. ✨

you can see wxToggleButton in action in page_samples_widgets β€” go look, it's cute.

see: wxCheckBox, wxButton, wxBitmapToggleButton (not implemented in wx β€” sad, i know 😭)

this class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler β€” so it inherited the whole family's powers, main character energy fr fr πŸ‘‘

wxWidgets docs: wxToggleButton


🌸 EVENTS 🌸

event types emitted from this class: command_togglebutton_clicked

like yes, that's the one. that's the event. write it down. πŸ’…


πŸ¦‹ DATA TYPES πŸ¦‹

  • wxToggleButton() = wx:wx_object() β€” it's a wx object bestie, that's it, that's the type.

✨ EXPORTS ✨ (the good stuff)

πŸ’œ new() -> wxToggleButton()

default constructor. no args, no thoughts, just vibes. 🫢

πŸ’œ 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. this is the one where you get to customize β€” position, size, style, validator, the whole aesthetic ✨

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

πŸ’œ destroy(This :: wxToggleButton()) -> ok

destructor, destroying the toggle button. it's over bestie, say bye πŸ‘‹πŸ’€

πŸ’œ 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. the way that this is just the build-later route 😌

see new/4 for details β€” same options, same energy.

πŸ’œ getValue(This) -> boolean()

types:

This = wxToggleButton()

gets the state of the toggle button. a little vibe check, if you will πŸ”

return: returns true if it is pressed, false otherwise. simple as that. πŸ“

πŸ’œ setValue(This, State) -> ok

types:

This = wxToggleButton()
State = boolean()

sets the toggle button to the given state. you pick pressed or not-pressed, and it obeys. πŸ‘‘

⚠️ heads up bestie β€” this does not cause a EVT_TOGGLEBUTTON event to be emitted. no event, no notification, nothing. it just... changes. silently. so don't sit there waiting for a callback that's never coming 😭

πŸŽ€ and that's the whole page!! every flag, every type, every signature β€” nothing skipped, no cap.

kisses from the wxWidgets team πŸ’– this was wx 2.2.2.1, mwah, bye bestie!! πŸŒˆβœ¨πŸ¦‹

πŸ“¦ where this page comes from