Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How get key down on launch?




On Nov 8, 2007, at 9:29 PM, Ken Drycksback wrote:

If the key in question is one of the modifier keys, you may be able to do something like this:

if (([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0)
  {
  // option-key down
  }

Unfortunately it's not working. And I'd prefer not to use the old event manager functions since I assume they are not supported under 64 bit.

Using [NSApp currentEvent] at launch won't work because there is no current event at that point - you haven't started running the event loop yet.


GetKeys actually is available in 64-bit HIToolbox, specifically because there didn't appear to be any other way to do this, so I think it's your best option for now.

-eric

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >How get key down on launch? (From: Ken Drycksback <email@hidden>)
 >Re: How get key down on launch? (From: Ricky Sharp <email@hidden>)
 >Re: How get key down on launch? (From: Ken Drycksback <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.