On Nov 21, 2008, at 12:42 PM, Paul McNett wrote:
>> What does callAfter "wait" for? IOW..after what?
>
> It waits until the next iteration of the app's main event loop.
To expand on that...
In a UI, events happen all the time. The processing of one event can
raise additional events. These are all queued by the UI framework's
event manager. When your code is executing, there may be several
pending events that will fire after the current code finishes
executing. If you call a method from that code, it happens right then,
with all those other events still waiting. But by using callAfter, you
create a new event that will call the passed method when it fires, and
this new method is placed at the end of the event queue.
An example of where this is valuable is when you want to do something
in a LostFocus handler: the various updates have probably not yet
fired, so when your handler code executes, it sees stale values that
don't yet reflect the new state. By issuing a callAfter(), though, you
ensure that any changes that result from losing focus will have
already been applied, and your method will execute with these new, up-
to-date values.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]