wxIdleEvent(3erl)
π wxIdleEvent(3erl) π
Erlang Module Definition, bestie! This page is giving class-manual energy for wxIdleEvent, and we're gonna get you comfy with it. π«Ά
πΈ NAME πΈ
wxIdleEvent β Functions for wxIdleEvent class β¨
π¦ DESCRIPTION π¦
Okay so this class is used for idle events, which are generated when the system becomes idle. π But listen: unless you do something specifically, idle events are not sent if the system remains idle once it has become it β e.g. only a single idle event will be generated until something else resulting in more normal events happens, and only then is the next idle event sent again. π
If you need to ensure a continuous stream of idle events, you can either use the requestMore/2 method in your handler or call ?wxWakeUpIdle() periodically (for example from a timer event handler).
β οΈ But bestie, note that both of these approaches (and especially the first one) increase the system load and so should be avoided if possible. π
By default, idle events are sent to all windows, including even the hidden ones β because they may be shown if some condition is met from their wxEVT_IDLE (or related wxEVT_UPDATE_UI) handler. π The children of hidden windows do not receive idle events however, as they can't change their state in any way noticeable by the user. Finally, the global wxApp (not implemented in wx) object also receives these events, as usual, so it can be used for any global idle time processing. β¨
If sending idle events to all windows is causing a significant overhead in your application, you can call setMode/1 with the value wxIDLE_PROCESS_SPECIFIED, and set the wxWS_EX_PROCESS_IDLE extra window style for every window which should receive idle events β all the other ones will not receive them in this case. π
π Delayed Action Mechanism π
wxIdleEvent can be used to perform some action "at slightly later time". This can be necessary in several circumstances when, for whatever reason, something can't be done in the current event handler. For example, if a mouse event handler is called with the mouse button pressed, the mouse can be currently captured and some operations with it β notably capturing it again β might be impossible or lead to undesirable results. π If you still want to capture it, you can do it from a wxEVT_IDLE handler when it is called the next time instead of doing it immediately. π¦
This can be achieved in two different ways:
- Static event tables: you will need a flag indicating to the (always connected) idle event handler whether the desired action should be performed. The originally called handler would then set it to indicate that it should indeed be done, and the idle handler itself would reset it to prevent it from doing the same action again. π₯
- Dynamically connected event handlers: things are even simpler, as the original event handler can simply
wxEvtHandler::Connect()(not implemented in wx) orwxEvtHandler::Bind()(not implemented in wx) the idle event handler β which would only be executed then β and couldwxEvtHandler::Disconnect()(not implemented in wx) orwxEvtHandler::Unbind()(not implemented in wx) itself. π
See: Overview events, wxUpdateUIEvent, wxWindow::OnInternalIdle (not implemented in wx) π
This class is derived (and can use functions) from: wxEvent π±
wxWidgets docs: wxIdleEvent π
β EVENTS β
Use wxEvtHandler:connect/3 with wxIdleEventType to subscribe to events of this type. β¨
π DATA TYPES π
Vibe check on the data types:
wxIdleEvent() = wx:wx_object()
wxIdle() = #wxIdle{type = wxIdleEvent:wxIdleEventType()}
wxIdleEventType() = idle
No cap, those are the data types. π
π EXPORTS π
The exports ate, ngl. π₯
π getMode() -> wx:wx_enum()
Static function returning a value specifying how wxWidgets will send idle events: to all windows, or only to those which specify that they will process the events. π
See: setMode/1 β¨
π requestMore(This) -> ok
Types:
This = wxIdleEvent()
π requestMore(This, Options :: [Option]) -> ok
Types:
This = wxIdleEvent()
Option = {needMore, boolean()}
Tells wxWidgets that more processing is required. π₯
This function can be called by an OnIdle handler for a window or window event handler to indicate that wxApp::OnIdle should forward the OnIdle event once more to the application windows. π«
If no window calls this function during OnIdle, then the application will remain in a passive event loop (not calling OnIdle) until a new event is posted to the application by the windowing system. π
See: moreRequested/1 π
π moreRequested(This) -> boolean()
Types:
This = wxIdleEvent()
Returns true if the OnIdle function processing this event requested more processing time. β
See: requestMore/2 β¨
π setMode(Mode) -> ok
Types:
Mode = wx:wx_enum()
Static function for specifying how wxWidgets will send idle events: to all windows, or only to those which specify that they will process the events. π
Shoutout to the wxWidgets team for the wx 2.2.2.1 footer, bestie β that's the source/version, and the date slot is a lil' mystery (none was printed). This page is wxIdleEvent(3erl), so bye! ππ¦
π¦ 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