wxSingleChoiceDialog(3)

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

✨ wxSingleChoiceDialog ✨

okay bestie, gather round πŸ’– this is an Erlang module page, and the module is literally called wxSingleChoiceDialog. Say it with me. Iconic name, no notes. πŸŽ€


πŸ’… NAME πŸ’…

wxSingleChoiceDialog β€” this class represents a dialog that shows a list of strings, and allows the user to select one. One. Just one. Singular. The moment where you have to commit to a choice and the dialog is like "pick 🫢".


🌸 DESCRIPTION 🌸

So here's the tea: double-clicking on a list item is equivalent to single-clicking and then pressing OK. Same energy, fewer steps, no cap. ✨

πŸ¦‹ Styles πŸ¦‹

This class supports the following styles, and yes you can mix and match:

  • wxOK β€” show an OK button. Obviously. πŸ’–
  • wxCANCEL β€” show a Cancel button. The escape hatch, we love her. πŸ™ˆ
  • wxCENTRE β€” centre the message. Main character energy, perfectly framed. πŸ‘‘

See also, because besties share their faves:

  • Overview cmndlg
  • wxMultiChoiceDialog (her sister who lets you pick many, we stan both 🌈)

This class is derived, and can use functions, from:

  • wxDialog
  • wxTopLevelWindow
  • wxWindow
  • wxEvtHandler

Up the whole family tree, fr fr. 🌳

wxWidgets docs: wxSingleChoiceDialog


⭐ DATA TYPES ⭐

wxSingleChoiceDialog() :: wx:wx_object().

That's it. That's the type. Clean, minimal, slay. πŸ’…


πŸ”₯ FUNCTIONS πŸ”₯

destroy/1 πŸŒ™

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

Destroys the object. It's giving "goodbye forever, bestie" πŸ’€ β€” the dialog is gone, the object is gone, the vibes are cleared.


getSelection/1 πŸ“

getSelection(This) -> integer()
                      when This :: wxSingleChoiceDialog().

Returns the index of selected item. Yes bestie, an index, not the string β€” that's a different function and we'll get there, patience my love 🧚


getStringSelection/1 πŸ‘‘

getStringSelection(This) -> unicode:charlist()
                            when This :: wxSingleChoiceDialog().

Returns the selected string. The actual text. unicode:charlist() and everything, look at her go ✨


new/5 πŸ’–

new(Parent, Message, Caption, Choices, [Option]) ->
         wxSingleChoiceDialog()
         when
             Parent :: wxWindow:wxWindow(),
             Message :: unicode:chardata(),
             Caption :: unicode:chardata(),
             Choices :: [unicode:chardata()],
             Option ::
                 {style, integer()} |
                 {pos, {X :: integer(), Y :: integer()}}.

Constructor, taking an array of wxString (not implemented in wx) choices and optional client data. That parenthesis is important, bestie β€” not implemented in wx, so don't come for me when it's not there 😭

Remark: use wxDialog:showModal/1 to show the dialog. Constructing it does not summon it. You gotta show it. Periodt. πŸ’…

Options you can pass: {style, integer()} and {pos, {X :: integer(), Y :: integer()}} β€” position her wherever she deserves, which is absolutely centre stage. πŸŽ€


setSelection/2 🌈

setSelection(This, Selection) -> ok
                      when
                          This :: wxSingleChoiceDialog(),
                          Selection :: integer().

Sets the index of the initially selected item. So when the dialog opens, she's already standing there, pre-picked, looking gorgeous πŸ¦‹ ok comes back and nothing else. Simply.


πŸ’œ SEE ALSO πŸ’œ

  • Overview cmndlg
  • wxMultiChoiceDialog
  • wxDialog
  • wxTopLevelWindow
  • wxWindow
  • wxEvtHandler
  • wxWidgets docs: wxSingleChoiceDialog

and that's the whole page, bestie, we ate and left no crumbs 🍽️✨ this was brought to you by Ericsson AB, tag wx 2.6, on this module's page for wxSingleChoiceDialog(3). iykyk πŸ«ΆπŸ’–

πŸ“¦ where this page comes from