wxEvtHandler(3)
π NAME π
wxEvtHandler β literally THE Event handler, bestie. From the Erlang Module Definition corner of the wx universe. π«Ά
β¨ DESCRIPTION β¨
Okay so picture this: a class that can handle events from the windowing system. That's the whole vibe. wxWindow is derived from this class β and therefore all window classes are too. It's giving main character energy, fr fr. π
To get events from wxwidgets objects you subscribe to them by calling connect/3. That's the move.
If the callback option is not supplied, events are sent as messages. π¬
Those messages will be #wx{} where EventRecord is a record that depends on the wxEventType. The records are defined in:
wx/include/wx.hrl
If a callback was supplied to connect, the callback will be invoked (in another process) to handle the event. The callback should be of arity 2.
fun Callback (EventRecord::wx(), EventObject::wxObject()).
β οΈ Note: the callback will be executed in a new process each and every time. Not the same process, a fresh one. Every single time. No cap. π
See: Overview events
wxWidgets docs: wxEvtHandler
π DATA TYPES π
π¦ event()
event() ::
wxActivateEvent:wxActivate() |
wxAuiManagerEvent:wxAuiManager() |
wxAuiNotebookEvent:wxAuiNotebook() |
wxBookCtrlEvent:wxBookCtrl() |
wxCalendarEvent:wxCalendar() |
wxChildFocusEvent:wxChildFocus() |
wxClipboardTextEvent:wxClipboardText() |
wxCloseEvent:wxClose() |
wxColourPickerEvent:wxColourPicker() |
wxCommandEvent:wxCommand() |
wxContextMenuEvent:wxContextMenu() |
wxDateEvent:wxDate() |
wxDisplayChangedEvent:wxDisplayChanged() |
wxDropFilesEvent:wxDropFiles() |
wxEraseEvent:wxErase() |
wxFileDirPickerEvent:wxFileDirPicker() |
wxFocusEvent:wxFocus() |
wxFontPickerEvent:wxFontPicker() |
wxGridEvent:wxGrid() |
wxHelpEvent:wxHelp() |
wxHtmlLinkEvent:wxHtmlLink() |
wxIconizeEvent:wxIconize() |
wxIdleEvent:wxIdle() |
wxInitDialogEvent:wxInitDialog() |
wxJoystickEvent:wxJoystick() |
wxKeyEvent:wxKey() |
wxListEvent:wxList() |
wxMaximizeEvent:wxMaximize() |
wxMenuEvent:wxMenu() |
wxMouseCaptureChangedEvent:wxMouseCaptureChanged() |
wxMouseCaptureLostEvent:wxMouseCaptureLost() |
wxMouseEvent:wxMouse() |
wxMoveEvent:wxMove() |
wxNavigationKeyEvent:wxNavigationKey() |
wxPaintEvent:wxPaint() |
wxPaletteChangedEvent:wxPaletteChanged() |
wxQueryNewPaletteEvent:wxQueryNewPalette() |
wxSashEvent:wxSash() |
wxScrollEvent:wxScroll() |
wxScrollWinEvent:wxScrollWin() |
wxSetCursorEvent:wxSetCursor() |
wxShowEvent:wxShow() |
wxSizeEvent:wxSize() |
wxSpinEvent:wxSpin() |
wxSplitterEvent:wxSplitter() |
wxStyledTextEvent:wxStyledText() |
wxSysColourChangedEvent:wxSysColourChanged() |
wxTaskBarIconEvent:wxTaskBarIcon() |
wxTreeEvent:wxTree() |
wxUpdateUIEvent:wxUpdateUI() |
wxWebViewEvent:wxWebView() |
wxWindowCreateEvent:wxWindowCreate() |
wxWindowDestroyEvent:wxWindowDestroy().
Likeβ¦ the whole event buffet. Name your fave, they're all here. π
π wx()
wx() :: #wx{}.
πΈ wxEventType()
wxEventType() ::
wxActivateEvent:wxActivateEventType() |
wxAuiManagerEvent:wxAuiManagerEventType() |
wxAuiNotebookEvent:wxAuiNotebookEventType() |
wxBookCtrlEvent:wxBookCtrlEventType() |
wxCalendarEvent:wxCalendarEventType() |
wxChildFocusEvent:wxChildFocusEventType() |
wxClipboardTextEvent:wxClipboardTextEventType() |
wxCloseEvent:wxCloseEventType() |
wxColourPickerEvent:wxColourPickerEventType() |
wxCommandEvent:wxCommandEventType() |
wxContextMenuEvent:wxContextMenuEventType() |
wxDateEvent:wxDateEventType() |
wxDisplayChangedEvent:wxDisplayChangedEventType() |
wxDropFilesEvent:wxDropFilesEventType() |
wxEraseEvent:wxEraseEventType() |
wxFileDirPickerEvent:wxFileDirPickerEventType() |
wxFocusEvent:wxFocusEventType() |
wxFontPickerEvent:wxFontPickerEventType() |
wxGridEvent:wxGridEventType() |
wxHelpEvent:wxHelpEventType() |
wxHtmlLinkEvent:wxHtmlLinkEventType() |
wxIconizeEvent:wxIconizeEventType() |
wxIdleEvent:wxIdleEventType() |
wxInitDialogEvent:wxInitDialogEventType() |
wxJoystickEvent:wxJoystickEventType() |
wxKeyEvent:wxKeyEventType() |
wxListEvent:wxListEventType() |
wxMaximizeEvent:wxMaximizeEventType() |
wxMenuEvent:wxMenuEventType() |
wxMouseCaptureChangedEvent:wxMouseCaptureChangedEventType() |
wxMouseCaptureLostEvent:wxMouseCaptureLostEventType() |
wxMouseEvent:wxMouseEventType() |
wxMoveEvent:wxMoveEventType() |
wxNavigationKeyEvent:wxNavigationKeyEventType() |
wxPaintEvent:wxPaintEventType() |
wxPaletteChangedEvent:wxPaletteChangedEventType() |
wxQueryNewPaletteEvent:wxQueryNewPaletteEventType() |
wxSashEvent:wxSashEventType() |
wxScrollEvent:wxScrollEventType() |
wxScrollWinEvent:wxScrollWinEventType() |
wxSetCursorEvent:wxSetCursorEventType() |
wxShowEvent:wxShowEventType() |
wxSizeEvent:wxSizeEventType() |
wxSpinEvent:wxSpinEventType() |
wxSplitterEvent:wxSplitterEventType() |
wxStyledTextEvent:wxStyledTextEventType() |
wxSysColourChangedEvent:wxSysColourChangedEventType() |
wxTaskBarIconEvent:wxTaskBarIconEventType() |
wxTreeEvent:wxTreeEventType() |
wxUpdateUIEvent:wxUpdateUIEventType() |
wxWebViewEvent:wxWebViewEventType() |
wxWindowCreateEvent:wxWindowCreateEventType() |
wxWindowDestroyEvent:wxWindowDestroyEventType().
Every event type has a matching EventType. Chef's kiss. Matched set, slay. π
π wxEvtHandler()
wxEvtHandler() :: wx:wx_object().
π FUNCTIONS π
π«Ά connect/3
connect(This :: wxEvtHandler(),
EventType :: wxEventType(),
[Option]) ->
ok
when
Option ::
{id, integer()} |
{lastId, integer()} |
{skip, boolean()} |
callback |
{callback, function()} |
{userData, term()}.
This function subscribes to events. It's the whole point bestie, okay, like β you slide in and you subscribe. π
Subscribes to events of type EventType, in the range id, lastId.
The events will be received as messages if no callback is supplied. π
β¨ Options β¨
id:{id, integer()}β The identifier (or first of the identifier range) to be associated with this event handler. Default is?wxID_ANYlastid:{lastId,integer()}β The second part of the identifier range. If used'id'must be set as the starting identifier range. Default is?wxID_ANYskip:{skip,boolean()}β If skip is true further event_handlers will be called. This is not used if the'callback'option is used. Default is false.callback:{callback,function()}β Use acallbackfun(EventRecord::wx(),EventObject::wxObject())to process the event. Default not specified i.e. a message will be delivered to the process calling this function.userData:{userData,term()}β An erlang term that will be sent with the event. Default:[].
π Bestie reminder:{skip,true}taps in more event_handlers, and it does absolutely nothing if you brought acallback. Pick a lane. π«
π¦ disconnect/3
disconnect(This :: wxEvtHandler(),
EventType :: wxEventType(),
[Option]) ->
boolean()
when
Option ::
{id, integer()} |
{lastId, integer()} |
{callback, function()}.
This function unsubscribes the process or callback fun from the event handler. Yeah. Unsubscribing. It's giving "we need to talk" but make it wholesome. π
EventType may be the atom 'null' to match any eventtype. Notice that the options skip and userdata is not used to match the eventhandler.
β οΈ Real talk: those two options don't participate in matching at all. They're just β¨thereβ¨ for the ride. Don't expect them to filter anything.
and that's the page, periodt β¨π
Mwah, ily for reading this far. π«Ά This masterpiece comes to you courtesy of Ericsson AB, plucked straight from the wx 2.6 era β like, vintage but make it iconic. π Lowkey a whole time capsule fr fr. π
π¦ 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