wxComboBox(3erl)

๐Ÿ“ฆ
version 25.3.2.8 ยท 5 versions
, in ubuntu noble

๐Ÿ’… wxComboBox(3erl) โ€” Erlang Module Definition ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

wxComboBox - Functions for wxComboBox class. Highkey iconic, no cap.

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so, no cap, a combobox is like a combination of an edit control and a listbox โ€” literally a little combo meal of UI widgets ๐Ÿ“.

It can be displayed as a static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field depending on the platform and presence of the wxCB_READONLY style. The way it switches up depending on platform and style is giving main character energy ๐Ÿ’….

A combobox permits a single selection only. No "choose five, bestie" chaos. Combobox items are numbered from zero.

If you need a customized combobox, have a look at wxComboCtrl (not implemented in wx), wxOwnerDrawnComboBox (not implemented in wx), wxComboPopup (not implemented in wx) and the ready-to-use wxBitmapComboBox (not implemented in wx). I'm obsessed with the options, but yes: all of those are not implemented in wx, noted ๐Ÿซถ.

Please refer to wxTextEntry (not implemented in wx) documentation for the description of methods operating with the text entry part of the combobox and to wxItemContainer (not implemented in wx) for the methods operating with the list of strings. Notice that at least under MSW wxComboBox doesn't behave correctly if it contains strings differing in case only so portable programs should avoid adding such strings to this control. That's a real warning, bestie โ€” lowkey important ๐Ÿ’€.

โœจ Styles โœจ

This class supports the following styles:

See: wxListBox, wxTextCtrl, wxChoice, wxCommandEvent

This class is derived (and can use functions) from: wxControlWithItems wxControl wxWindow wxEvtHandler

wxWidgets docs: wxComboBox

๐ŸŽ€ EVENTS ๐ŸŽ€

Event types emitted from this class:

  • command_combobox_selected
  • command_text_updated
  • command_text_enter
  • combobox_dropdown
  • combobox_closeup

๐ŸŒˆ DATA TYPES ๐ŸŒˆ

wxComboBox() = wx:wx_object()

๐Ÿ”ฅ EXPORTS ๐Ÿ”ฅ

new/0 โ€” default constructor ๐ŸŒธ

new() -> wxComboBox()

Default constructor.

new/2 โ€” constructor with Parent and Id ๐ŸŽ€

new(Parent, Id) -> wxComboBox()

Types:

Parent = wxWindow:wxWindow()
Id = integer()

new/3 โ€” constructor with options, slay โœจ

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

Types:

Parent = wxWindow:wxWindow()
Id = integer()
Option =
    {value, unicode:chardata()} |
    {pos, {X :: integer(), Y :: integer()}} |
    {size, {W :: integer(), H :: integer()}} |
    {choices, [unicode:chardata()]} |
    {style, integer()} |
    {validator, wx:wx_object()}

Constructor, creating and showing a combobox.

See: create/8, wxValidator (not implemented in wx)

destroy/1 โ€” destructor, bye-bye combobox ๐Ÿ’€

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

Destructor, destroying the combobox.

create/7 โ€” create it, no options edition ๐Ÿฆ‹

create(This, Parent, Id, Value, Pos, Size, Choices) -> boolean()

Types:

This = wxComboBox()
Parent = wxWindow:wxWindow()
Id = integer()
Value = unicode:chardata()
Pos = {X :: integer(), Y :: integer()}
Size = {W :: integer(), H :: integer()}
Choices = [unicode:chardata()]

create/8 โ€” create it with options, periodt ๐Ÿ’…

create(This, Parent, Id, Value, Pos, Size, Choices,
       Options :: [Option]) ->
          boolean()

Types:

This = wxComboBox()
Parent = wxWindow:wxWindow()
Id = integer()
Value = unicode:chardata()
Pos = {X :: integer(), Y :: integer()}
Size = {W :: integer(), H :: integer()}
Choices = [unicode:chardata()]
Option = {style, integer()} | {validator, wx:wx_object()}

canCopy/1 โ€” clipboard vibe check for copy ๐Ÿ“‹

canCopy(This) -> boolean()

Types:

This = wxComboBox()

Returns true if the selection can be copied to the clipboard.

canCut/1 โ€” clipboard vibe check for cut โœ‚๏ธ

canCut(This) -> boolean()

Types:

This = wxComboBox()

Returns true if the selection can be cut to the clipboard.

canPaste/1 โ€” can we paste, bestie? ๐Ÿ“‹โœจ

canPaste(This) -> boolean()

Types:

This = wxComboBox()

Returns true if the contents of the clipboard can be pasted into the text control.

On some platforms (Motif, GTK) this is an approximation and returns true if the control is editable, false otherwise. So it's giving "maybe" energy on those platforms, iykyk.

canRedo/1 โ€” redo facility check ๐Ÿ”

canRedo(This) -> boolean()

Types:

This = wxComboBox()

Returns true if there is a redo facility available and the last operation can be redone.

canUndo/1 โ€” undo facility check โ†ฉ๏ธ

canUndo(This) -> boolean()

Types:

This = wxComboBox()

Returns true if there is an undo facility available and the last operation can be undone.

copy/1 โ€” copy selected text ๐ŸŽ€

copy(This) -> ok

Types:

This = wxComboBox()

Copies the selected text to the clipboard.

cut/1 โ€” cut selected text โœ‚๏ธ

cut(This) -> ok

Types:

This = wxComboBox()

Copies the selected text to the clipboard and removes it from the control.

getInsertionPoint/1 โ€” where's the cursor? ๐Ÿ“

getInsertionPoint(This) -> integer()

Types:

This = wxComboBox()

Same as wxTextCtrl:getInsertionPoint/1.

Note: Under wxMSW, this function always returns 0 if the combobox doesn't have the focus. That's the caveat, bestie โ€” don't forget it ๐Ÿ’€.

getLastPosition/1 โ€” last text position, zero-based ๐Ÿงฎ

getLastPosition(This) -> integer()

Types:

This = wxComboBox()

Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.

getValue/1 โ€” get the contents ๐Ÿ’–

getValue(This) -> unicode:charlist()

Types:

This = wxComboBox()

Gets the contents of the control.

Notice that for a multiline text control, the lines will be separated by (Unix-style) \n characters, even under Windows where they are separated by a \r\n sequence in the native control. So cute, so cross-platform, so important to remember ๐ŸŒˆ.

paste/1 โ€” paste from clipboard ๐Ÿ“‹

paste(This) -> ok

Types:

This = wxComboBox()

Pastes text from the clipboard to the text item.

redo/1 โ€” redo the last operation ๐Ÿ”

redo(This) -> ok

Types:

This = wxComboBox()

If there is a redo facility and the last operation can be redone, redoes the last operation.

Does nothing if there is no redo facility. Literally nothing. No drama, no error, just vibes.

replace/4 โ€” replace text from From to To ๐ŸŒธ

replace(This, From, To, Value) -> ok

Types:

This = wxComboBox()
From = To = integer()
Value = unicode:chardata()

Replaces the text starting at the first position up to (but not including) the character at the last position with the given text.

This function puts the current insertion point position at to as a side effect. Side-effect queen, honestly.

remove/3 โ€” remove text from From to To ๐Ÿงน

remove(This, From, To) -> ok

Types:

This = wxComboBox()
From = To = integer()

Removes the text starting at the first given position up to (but not including) the character at the last position.

This function puts the current insertion point position at to as a side effect. Same side-effect energy, no cap.

setInsertionPoint/2 โ€” put the cursor somewhere specific ๐Ÿ“

setInsertionPoint(This, Pos) -> ok

Types:

This = wxComboBox()
Pos = integer()

Sets the insertion point at the given position.

setInsertionPointEnd/1 โ€” cursor to the end ๐Ÿ

setInsertionPointEnd(This) -> ok

Types:

This = wxComboBox()

Sets the insertion point at the end of the text control.

This is equivalent to calling setInsertionPoint/2 with getLastPosition/1 argument.

setSelection/2 โ€” select item by number ๐ŸŽฏ

setSelection(This, N) -> ok

Types:

This = wxComboBox()
N = integer()

Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND.

Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections. It's giving quiet selection, no event spam ๐Ÿ’….

See: wxControlWithItems:setString/3, wxControlWithItems:setStringSelection/2

setSelection/3 โ€” select text range โœจ

setSelection(This, From, To) -> ok

Types:

This = wxComboBox()
From = To = integer()

Same as wxTextCtrl:setSelection/3.

setValue/2 โ€” set the text field ๐Ÿ–Š๏ธ

setValue(This, Text) -> ok

Types:

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

Sets the text for the combobox text field.

For normal, editable comboboxes with a text entry field calling this method will generate a wxEVT_TEXT event, consistently with wxTextCtrl:setValue/2 behaviour, use wxTextCtrl:changeValue/2 if this is undesirable.

For controls with wxCB_READONLY style the method behaves somewhat differently: the string must be in the combobox choices list (the check for this is case-insensitive) and wxEVT_TEXT is not generated in this case. Read-only means read-only, bestie โ€” respect the boundary ๐Ÿซถ.

undo/1 โ€” undo the last operation โ†ฉ๏ธ

undo(This) -> ok

Types:

This = wxComboBox()

If there is an undo facility and the last operation can be undone, undoes the last operation.

Does nothing if there is no undo facility. Again: no facility, no drama, no error.


๐ŸŽ€ cute sign-off ๐ŸŽ€ โ€” from wxWidgets team. with version wx 2.2.2.1, page wxComboBox(3erl); no separate date shows up in this footer, so consider this your timestamp, bestie ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from