Re: Cocoa equivalent for 'InstallApplicationEventHandler'
Re: Cocoa equivalent for 'InstallApplicationEventHandler'
- Subject: Re: Cocoa equivalent for 'InstallApplicationEventHandler'
- From: Uli Kusterer <email@hidden>
- Date: Sat, 20 Feb 2010 13:08:14 +0100
On 20.02.2010, at 12:53, Tom Davie wrote:
> You want NSEvent's
>
> + (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)*mask* handler:(void
> (^)(NSEvent*))*block*
> *and*
> *
>
> + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent*
> (^)(NSEvent*))block
Nope, that's the wrong choice. This would give him copies of events sent to *other* applications as well (hence the "global").
The sendEvent override seems like the most workable solution to me so far. Though I'd suggest not doing the work directly in your application instance. Instead, forward the event to your delegate. That way, you can use the same NSApplication subclass in your other apps.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://groups.yahoo.com/group/mac-gui-dev/
_______________________________________________
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