In Mac OS 10.6, during -applicationDidFinishLaunching, [NSEvent currentEvent] 
returns nil, so the usual code,

   [[NSEvent currentEvent] modifierFlags]

is not useful for determining if a modifier key was held down during launch.  
(By accident, I've noticed that I do get an event with correct modifierFlags if 
I send the message after a performSelector:withObject:afterDelay:.05.  But I'd 
rather not do that.)

Searching the list archives, from 8 years ago I find the solution is to instead 
#import <Carbon/Carbon.h> and use GetCurrentEventKeyModifiers().

It works, and although there is copious documentation in the header and in the 
Carbon Event Manager Programming Guide, searching current Xcode documentation 
for this function gives "No Results", and since this function returns a UInt32, 
I wonder if it will be supported in current and future 64-bit builds? 

Thanks,

Jerry Krinock_______________________________________________

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