wxCommandEvent(3erl)
π wxCommandEvent (Erlang Module Definition) π
okay so this is the manual page for the wxCommandEvent module β literally the functions for the wxCommandEvent class, and it's giving "small but mighty" energy ngl.
β¨ NAME β¨
wxCommandEvent β functions for the wxCommandEvent class. that's it, that's the name, slay π
πΈ DESCRIPTION πΈ
bestie, listen. this event class is literally carrying information about command events β the ones that originate from a whole variety of simple controls. think of it as the group chat of wx events: lots of sources, one vibe. π¦
okay now the important part, so pay attention: wxCommandEvents and wxCommandEvent-derived event classes by default β and unlike other wxEvent-derived classes β propagate upward from the source window (like, the window which emits the event) all the way up to the first parent that actually processes the event. the way that works is iconic but you gotta know it, so fr fr go read overview_events_propagation. no cap, it's required reading. π
also quick heads up: more complex controls β think wxTreeCtrl β have their own separate command event classes. they're not sharing this one, they're main character energy in their own right π
this class is derived (and can use functions) from: wxEvent β so all that inherited goodness is yours too π«Ά
wxWidgets docs: wxCommandEvent β go look it up if you want the source material β¨
π₯ EVENTS π₯
use wxEvtHandler:connect/3 with wxCommandEventType to subscribe to events of this type. that's the whole recipe, periodt π
π§ DATA TYPES π§
here's the type situation, copy-pasted with love (well, retyped with love):
wxCommandEvent() = wx:wx_object()
wxCommand() =
#wxCommand{type = wxCommandEvent:wxCommandEventType(),
cmdString = unicode:chardata(),
commandInt = integer(),
extraLong = integer()}
and the big one β the event type roster. look at all these options, she ate:
wxCommandEventType() =
command_button_clicked | command_checkbox_clicked |
command_choice_selected | command_listbox_selected |
command_listbox_doubleclicked | command_text_updated |
command_text_enter | text_maxlen | command_menu_selected |
command_slider_updated | command_radiobox_selected |
command_radiobutton_selected | command_scrollbar_updated |
command_vlbox_selected | command_combobox_selected |
combobox_dropdown | combobox_closeup | command_tool_rclicked |
command_tool_enter | tool_dropdown |
command_checklistbox_toggled | command_togglebutton_clicked |
command_left_click | command_left_dclick |
command_right_click | command_set_focus | command_kill_focus |
command_enter | notification_message_click |
notification_message_dismissed | notification_message_action
like, that's a list. 32 little atoms and every single one of them matters π
π EXPORTS π
π getClientData(This) -> term()
types:
This = wxCommandEvent()
returns the client object pointer for a listbox or choice selection event. tiny caveat: it's not valid for a deselection, so don't come for her when it returns nonsense on a deselect, iykyk π
π getExtraLong(This) -> integer()
types:
This = wxCommandEvent()
returns extra information, and that info depends on the event object's type β so it's a vibe check by event kind, basically π
if the event comes from a listbox selection, it's a boolean determining whether the event was a selection (true) or a deselection (false). now here's the plot twist: a listbox deselection only occurs for multiple-selection boxes, and in that case the index and string values are indeterminate and your app has to go examine the listbox itself. so don't trust those values, go look at the real thing π
π getInt(This) -> integer()
types:
This = wxCommandEvent()
returns the integer identifier corresponding to a listbox, choice or radiobox selection β only if the event was a selection, not a deselection β or a boolean value representing the value of a checkbox. multitasking queen π
for a menu item, this method returns -1 if the item is not checkable, or a boolean value (true or false) for checkable items indicating the new state of the item. yes it switches return types, no we're not gonna fight about it β¨
π getSelection(This) -> integer()
types:
This = wxCommandEvent()
returns the item index for a listbox or choice selection event. again: not valid for a deselection. we said what we said π
π getString(This) -> unicode:charlist()
types:
This = wxCommandEvent()
returns the item string for a listbox or choice selection event. cute! but wait, there's lore:
if one or several items have been deselected, it returns the index of the first deselected item. and if some items have been selected and others deselected at the same time, it will return the index of the first selected item. yes, that's genuinely what it says β it's a chaotic function and we respect her π¦
π isChecked(This) -> boolean()
types:
This = wxCommandEvent()
this one can be used with checkbox and menu events: for checkboxes, the method returns true for a selection event and false for a deselection one π₯
for menu events, this method indicates if the menu item just has become checked or unchecked β and thus it only makes sense for checkable menu items. don't use it on non-checkable ones, that's not the vibe π
β οΈ heads up bestie: notice that this method cannot be used with wxCheckListBox currently. it's a known limitation, not you being bad at this, okay? π«Ά
π isSelection(This) -> boolean()
types:
This = wxCommandEvent()
for a listbox or similar event, returns true if it's a selection, false if it's a deselection. simple, clean, iconic β
and if some items have been selected and others deselected at the same time, it will return true β yes, even with the mixed chaos. choose joy πΈ
π setInt(This, IntCommand) -> ok
types:
This = wxCommandEvent()
IntCommand = integer()
sets the m_commandInt member. short and sweet, ok β
π setString(This, String) -> ok
types:
This = wxCommandEvent()
String = unicode:chardata()
sets the m_commandString member. same energy, different member π
π and that's the whole page! every option, every type, every caveat β nothing skipped, because we don't do that here π
big sign-off energy: this masterpiece was brought to you by the wxWidgets team, from wx 2.2.2.1, and the date line is literally the same thing again β wx 2.2.2.1 β so yeah, shoutout to them for the docs, and shoutout to you for reading all the way down here ππβ¨π¦
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms