wxSpinCtrl(3erl)

πŸ¦‹ wxSpinCtrl πŸ¦‹

Okay bestie, this is the manual page for wxSpinCtrl β€” Erlang Module Definition β€” and it's literally about to make sense. ✨


πŸŽ€ NAME πŸŽ€

  • wxSpinCtrl β€” Functions for wxSpinCtrl class.

🌸 DESCRIPTION 🌸

wxSpinCtrl combines wxTextCtrl and wxSpinButton in one control. Slay. πŸ’…

🌈 Styles 🌈

This class supports the following styles:

Heads up: the original page says that and then lists no styles under it. That's the whole entry, bestie β€” no cap. 🫢

See: wxSpinButton, wxSpinCtrlDouble (not implemented in wx), wxControl.

This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler. Iconic inheritance moment.

wxWidgets docs: wxSpinCtrl


πŸ”₯ EVENTS πŸ”₯

Event types emitted from this class: command_spinctrl_updated. That's the one to remember, iykyk.


πŸ’œ DATA TYPES πŸ’œ

wxSpinCtrl() = wx:wx_object()

πŸ‘‘ EXPORTS πŸ‘‘

✨ new/0 ✨

new() -> wxSpinCtrl()

Default constructor. Short, sweet, main character energy. πŸŽ€

✨ new/1 ✨

new(Parent) -> wxSpinCtrl()

Types:

Parent = wxWindow:wxWindow()

✨ new/2 ✨

new(Parent, Options :: [Option]) -> wxSpinCtrl()

Types:

Parent = wxWindow:wxWindow()
Option =
    {id, integer()} |
    {value, unicode:chardata()} |
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {style, integer()} |
    {min, integer()} |
    {max, integer()} |
    {initial, integer()}

Constructor, creating and showing a spin control. We love a control that shows up and shows out. πŸ’–

If value is non-empty, it will be shown in the text entry part of the control and if it has numeric value, the initial numeric value of the control, as returned by getValue/1 will also be determined by it instead of by initial. Hence, it only makes sense to specify initial if value is an empty string or is not convertible to a number, otherwise initial is simply ignored and the number specified by value is used.

This is the important lore: value can absolutely steal the show from initial, bestie. Don't fight it. 😭

See: create/3.

✨ create/2 ✨

create(This, Parent) -> boolean()

Types:

This = wxSpinCtrl()
Parent = wxWindow:wxWindow()

✨ create/3 ✨

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

Types:

This = wxSpinCtrl()
Parent = wxWindow:wxWindow()
Option =
    {id, integer()} |
    {value, unicode:chardata()} |
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {style, integer()} |
    {min, integer()} |
    {max, integer()} |
    {initial, integer()}

Creation function called by the spin control constructor.

See new/2 for details.

✨ setValue/2 ✨

setValue(This, Value) -> ok
setValue(This, Text) -> ok

Types:

This = wxSpinCtrl()
Text = unicode:chardata()

Sets the value of the spin control. Getter and setter behavior, classic. πŸ’…

It is recommended to use the overload taking an integer value instead.

Notice that, unlike wxTextCtrl:setValue/2, but like most of the other setter methods in wxWidgets, calling this method does not generate any events as events are only generated for the user actions.

So if you're setting it programmatically, don't expect an event to pop off. The events are for user actions, periodt. 🫢

✨ getValue/1 ✨

getValue(This) -> integer()

Types:

This = wxSpinCtrl()

Gets the value of the spin control. Literally the numeric tea. β˜•βœ¨

✨ setRange/3 ✨

setRange(This, MinVal, MaxVal) -> ok

Types:

This = wxSpinCtrl()
MinVal = MaxVal = integer()

Sets range of allowable values.

Notice that calling this method may change the value of the control if it's not inside the new valid range, e.g. it will become minVal if it is less than it now. However no wxEVT_SPINCTRL event is generated, even if it the value does change.

Note: Setting a range including negative values is silently ignored if current base is set to 16. Silently ignored, bestie β€” no warning, no drama, just vibes. πŸ’€

✨ setSelection/3 ✨

setSelection(This, From, To) -> ok

Types:

This = wxSpinCtrl()
From = To = integer()

Select the text in the text part of the control between positions from (inclusive) and to (exclusive).

This is similar to wxTextCtrl:setSelection/3.

Note: this is currently only implemented for Windows and generic versions of the control. Platform check, bestie.

✨ getMin/1 ✨

getMin(This) -> integer()

Types:

This = wxSpinCtrl()

Gets minimal allowable value. Smallest but still iconic. πŸŽ€

✨ getMax/1 ✨

getMax(This) -> integer()

Types:

This = wxSpinCtrl()

Gets maximal allowable value. Maximum slay. 🌈

✨ destroy/1 ✨

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

Destroys the object. Goodbye, queen. πŸ‘‘


Sign-off cuteness 🫢: the footer credits the wxWidgets team. and version wx 2.2.2.1, with the right-hand label wxSpinCtrl(3erl) β€” and since the original footer doesn't print a separate date, that's literally all the date-adjacent info we got, bestie. Stay iconic. πŸ’–βœ¨

πŸ“¦ where this page comes from