Managing the event loop in Cocoa
Managing the event loop in Cocoa
- Subject: Managing the event loop in Cocoa
- From: "Jeff Bland" <email@hidden>
- Date: Thu, 28 Jun 2007 16:02:41 +0900
Hello everyone,
I recently begin porting an application from Carbon to Cocoa, and things are
going well (objective-c[++] is surprisingly simple, even though I was a bit
scared at first).
One thing my applications needs to do is to run the event loop manually. It
is an API that works not by returning control to the end application during
events, but instead leaves the end application in charge of the main loop.
I achieved this in Carbon by using a custom event to break out of
RunApplicationEventLoop() (which i needed so I could use the standard
application handler), then using ReceiveNextEvent() to check the event queue
manually when the end applications calls one of my API functions.
In Cocoa documentation, it says that you can manage the run loop by deriving
from NSApplication (though it's not recommended), and notes that overriding
run is "a critical and complex task, however, that you should only attempt
with good reason.)".
So should I override run, or would it be possible/better to use a custom
event to break out of loop in the application run method as I did in Carbon.
Where can I find more info on the previously mentioned complexities of the
run method?
Thanks,
- Jeff Bland
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden