Re: detect option key on startup
Re: detect option key on startup
- Subject: Re: detect option key on startup
- From: Chris Hanson <email@hidden>
- Date: Sat, 09 May 2009 20:19:51 -0700
On May 9, 2009, at 11:22 AM, Mitchell Livingston wrote:
I want to be able to detect if the option key is being held down on
launch. I found reference to GetCurrentKeyModifiers(), but that
seems to be depreciated/not recommended.
Depending on when you're trying to check for the key down, I'd first
try [[NSApp currentEvent] modifierFlags]. According to this weblog
post <http://lipidity.com/apple/modifier-flags-launch/> though,
calling -[NSApplication currentEvent] early enough during launch may
just return nil.
A suggestion by Qwerty Denzel in the comments is to use Quartz Event
Services (CGEvents), introduced in Mac OS X 10.4. <http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/index.html
>
-- Chris
_______________________________________________
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