WakeUpIdle can be called periodically to tell the framework to start
sending more idle events.
RequestMore is a method of the IdleEvent class and can be called
inside your idle event handler to the tell the framework to keep
sending idle events.
So if I could choose between the two methods (call WakeUpIdle from
somewhere periodically, or call RequestMore from inside my idle event
handler), when would I prefer one over the other?
In an idle event handler method, what is the difference between doing
a RequestMore() and a WakeUpIdle()? It seems to me they have the same
effect...
WakeUpIdle can be called periodically to tell the framework to start
sending more idle events.
Basically it works by posting a NULL message to the app's message queue so the queue will be sure to become empty again soon, which is what triggers idle events (becoming empty.)
RequestMore is a method of the IdleEvent class and can be called
inside your idle event handler to the tell the framework to keep
sending idle events.
It checks if there are no pending messages and if not then it does another iteration of the idle processing code, otherwise it processes the pending events first and delays the next iteration of the idle processing code until after the message queue becomes empty again.
So yes, for most use cases they are almost equivalent, but there are subtle differences. The proper (supported) way to do it is to use RequestMore if the calling code is in an EVT_IDLE handler, and to use wx.WakeUpIdle from things that are external to the idle handlers, like from a timer or a worker thread. By "supported" I mean that if there is ever some fundamental change to the implementation of idle event processing then you can be reasonably sure that this approach will continue to work the same.
···
On 5/18/10 5:47 PM, Cody Precord wrote:
On Tue, May 18, 2010 at 5:57 PM, Jim<jmatthieson@gmail.com> wrote: