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

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

Reply via email to