On May 21, 2013, at 6:51 AM, Steve Mills <smi...@makemusic.com> wrote:

> On May 21, 2013, at 01:58:00, Kyle Sluder <k...@ksluder.com> wrote:
> 
>> The docs for +[NSEvent addLocalMonitor…] state that it does not work with 
>> nested event loops like the kind -[NSApplication runModalForWindow:] uses.
> 
> The docs don't specifically say runModalForWindow, which leads the reader to 
> assume it would work. Docs should always spell out exactly when something 
> won't work if the vendor already knows of such things.

It quite clearly says it will not work with nested event loops. 
+runModalForWindow: is but one way to run a nested event loop. It's not the job 
of every method's documentation to teach you how the entire framework works.

> 
> So then, what's the next thing to try? Seems like the next best thing is to 
> subclass NSApplication, override sendEvent, and add special code to it just 
> to handle this one small thing in a huge complex app.

You could try it, but +runModalForWindow might not invoke -sendEvent: to 
dispatch the events it pulls off the event queue within its nested runloop 
invocation.

> Or is there a way to create a new "regular" event loop?

Let's back up to your original question. Why do you need to run a runloop at 
all? NSPopupButtonCell will do that for you, and it will correctly handle the 
case where the user clicks outside the menu to dismiss.

Look up -performClickWithFrame:inView:.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to