wxFocusEvent(3)
π wxFocusEvent π
okay bestie, welcome to the Erlang Module Definition for wxFocusEvent β yes that's the module name, it's in the wx family, and it's giving main character energy in the focus department π
β¨ NAME β¨
wxFocusEvent β bestie, a focus event gets sent when a window's focus changes. that's it, that's the vibe π¦
πΈ DESCRIPTION πΈ
so here's the tea: the window that's losing focus receives a "kill focus" event, and the window that's gaining it gets a "set focus" one. it's giving breakup and glow-up at the same time ππβ¨
be aware (lowkey important): the set focus event happens both when the user gives focus to the window β whether that's with the mouse or the keyboard β and when it's done from the program itself using wxWindow:setFocus/1. so it's not just a user thing, your own code can trigger it too, no cap π
the focus event handlers should almost invariably call wxEvent:skip/2 on their event argument so the default handling can take place. fr fr, if you don't do this you may get incorrect behaviour of the native controls π not a vibe. also β and this is the big one β a wxEVT_KILL_FOCUS handler must not call wxWindow:setFocus/1, because again, that's not supported by all native controls π. if you genuinely need to do that, consider using the Delayed Action Mechanism (not implemented in wx), which is described over in the wxIdleEvent documentation. iykyk π§
See: Overview events
this class is derived, and can use functions, from:
wxEvent
wxWidgets docs: wxFocusEvent
π Events π
use wxEvtHandler:connect/3 with wxFocusEventType to subscribe to events of this type. go off, subscribe, be notified π
π DATA TYPES π
wxFocus() :: #wxFocus{}.wxFocusEvent() :: wx:wx_object().wxFocusEventType() :: set_focus | kill_focus.
periodt. two types of focus energy, pick your fighter β
π«Ά FUNCTIONS π«Ά
getWindow(This) -> wxWindow:wxWindow()whenThis :: wxFocusEvent().
returns the window associated with this event β which is literally the window that had the focus before, for the wxEVT_SET_FOCUS event, and the window that's going to receive focus, for the wxEVT_KILL_FOCUS one. so it's a different window depending on which event you're in, bestie, don't get it twisted π
β οΈ Warning: the window pointer may be NULL! π± check it before you dereference it, or it's giving segfault core.
that's the whole page, no skips, no summaries, every flag and every fact accounted for π stan a well-documented event class.
this was brought to you by Ericsson AB, wx 2.6, page wxFocusEvent(3) β mwah, go forth and skip your events properly πππ¦β¨
π¦ 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