wxToggleButton(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxToggleButton πŸ’–

okay bestie, welcome to the wxToggleButton manual from the Erlang Module Definition side of the world β€” yes it's a C++-flavoured wxWidgets thing but we're reading it through Erlang glasses and honestly? she's serving. ✨


πŸŽ€ NAME πŸŽ€

wxToggleButton β€” no cap, this is a button that stays pressed when clicked by the user. like she does NOT bounce back, she commits. periodt. πŸ’…


🌸 DESCRIPTION 🌸

so, in other words (and I do mean in other words, that's literally what the doc says), she's similar to wxCheckBox in functionality but she looks like a wxButton. a checkbox on the inside, a button on the outside. main character duality. πŸ¦‹

since wxWidgets version 2.9.0 this control emits an update UI event. keep that in your notes bestie, it matters. πŸ“

you can see wxToggleButton in action in page_samples_widgets. go look, it's giving demo energy. πŸ”₯

See:

  • wxCheckBox
  • wxButton

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

like she's clicking AND toggling. we love a multitasking queen. πŸ‘‘


🌈 DATA TYPES 🌈

wxToggleButton() :: wx:wx_object().

yes that's it. she IS a wx object. iconic, no notes. ✨


πŸ’œ FUNCTIONS πŸ’œ

hiii here's the whole roster, don't skip anyone, they all matter πŸ’–


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

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. like, build first, decorate later. πŸŽ€

See new/4 for details. (she's basically the sibling function, we'll get there.)


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

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

destroys the object. 😭 rip little button, you did amazing sweetie.

okay so this one has no period at the end in the original and I'm respecting that, and yes it's just "Destroys the object" β€” nothing more, nothing less. don't read into it. πŸ’€

getValue(This) -> boolean()

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

gets the state of the toggle button. the vibe check, if you will. 🫢

Return: Returns true if it is pressed, false otherwise. that's the whole tea. β˜•


new() -> wxToggleButton()

new() -> wxToggleButton().

default constructor. she's the no-args girlie β€” shows up with nothing, ready for anything. πŸ’…


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

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. note the and showing β€” she arrives ready to be perceived. 🌟

See: create/5


setValue(This, State) -> ok

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

sets the toggle button to the given state. you tell her State, she becomes State. queen of taking direction. πŸ‘‘

⚠️ important bestie, do not skip this: This does not cause a EVT_TOGGLEBUTTON event to be emitted. like, she changes, but she does NOT announce it. silent glow-up. no drama. (ok well, no event drama.) πŸ”‡

🌸 cute lil sign-off 🌸

that's the whole page babe, every option, every default, every type left exactly where it was β€” facts untouched, vibe upgraded. πŸ’–

shoutout to Ericsson AB for this one, from the wx 2.6 era β€” and yes bestie, the manual page itself is wxToggleButton(3), so now you know exactly what you just read. go forth and toggle. πŸ¦‹βœ¨

<tada>πŸ’… mwah, bye πŸ’…</tada>

πŸ“¦ where this page comes from