wxCommandEvent(3)
β¨ NAME β¨
okay so bestie, gather round: wxCommandEvent(3) β this is the Erlang Module Definition for wxCommandEvent, and it's literally the event class that holds all the info about command events, the ones that come from a whole bunch of simple controls. π«Ά
πΈ DESCRIPTION πΈ
first thing, and this is the important one: wxCommandEvents, and every event class derived from wxCommandEvent, propagate upward by default β from the source window (the window that emits the event) up to the first parent which processes the event. And this is unlike other wxEvent-derived classes, so don't be surprised, okay? Be sure to read overview_events_propagation. fr fr. πβ¨
Also, more complex controls β like wxTreeCtrl, hi queen β have their own separate command event classes. So this one is not covering those. π
This class is derived from, and can use functions from:
wxEvent
wxWidgets docs: wxCommandEvent
π Events π
Use wxEvtHandler:connect/3 with wxCommandEventType to subscribe to events of this type. that's the whole vibe check, go off β¨
π¦ DATA TYPES π¦
wxCommand() :: #wxCommand{}.
wxCommandEvent() :: wx:wx_object().
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.
look at all those atoms, she's iconic for that π
π FUNCTIONS π
getClientData
getClientData(This) -> term() when This :: wxCommandEvent().
Returns the client object pointer for a listbox or choice selection event β and heads up, not valid for a deselection. π
getExtraLong
getExtraLong(This) -> integer() when This :: wxCommandEvent().
Returns extra information that depends on the type of the event object. iykyk, it's giving "it depends".
If the event comes from a listbox selection, it's a boolean deciding whether the event was a selection (true) or a deselection (false). And a listbox deselection only happens for multiple-selection boxes β and in that case the index and string values are indeterminate and your application has to go examine the listbox itself. so like, don't trust those values, bestie. π
getInt
getInt(This) -> integer() when 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.
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. periodt. π₯
getSelection
getSelection(This) -> integer() when This :: wxCommandEvent().
Returns the item index for a listbox or choice selection event β again, not valid for a deselection. π
getString
getString(This) -> unicode:charlist()
when This :: wxCommandEvent().
Returns the item string for a listbox or choice selection event. π
If one or several items have been deselected, it returns the index of the first deselected item. And if some items got selected and others got deselected at the same time? It'll return the index of the first selected item. multitasking queen π
isChecked
isChecked(This) -> boolean() when This :: wxCommandEvent().
This one works with checkbox and menu events: for checkboxes, it returns true for a selection event and false for a deselection one. β
For menu events, it indicates whether the menu item just became checked or unchecked β so it only makes sense for checkable menu items, ngl.
Notice: this method cannot be used with wxCheckListBox currently. π that's just how it is.
isSelection
isSelection(This) -> boolean() when This :: wxCommandEvent().
For a listbox or similar event, returns true if it's a selection, false if it's a deselection. π
And if some items were selected while others were deselected at the same time, it returns true. she picks a side π
setInt
setInt(This, IntCommand) -> ok
when This :: wxCommandEvent(), IntCommand :: integer().
Sets the m_commandInt member. simple as that β¨
setString
setString(This, String) -> ok
when
This :: wxCommandEvent(),
String :: unicode:chardata().
Sets the m_commandString member. cute, done, slay π
and that's the whole page, bestie!! this one came to you courtesy of Ericsson AB and wx 2.6 β go forth and connect your event handlers, you've got this ππ¦β¨
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms