• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Managing the event loop in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Managing the event loop in Cocoa
      • From: Michael Watson <email@hidden>
  • Prev by Date: NSTextField Modification
  • Next by Date: Re: Managing the event loop in Cocoa
  • Previous by thread: NSTextField Modification
  • Next by thread: Re: Managing the event loop in Cocoa
  • Index(es):
    • Date
    • Thread