On Apr 2, 2010, at 10:30 AM, Jens Alfke wrote: > On Apr 2, 2010, at 1:45 AM, Gideon King wrote: > >> 1. I'm not sure what keyboard or mouse options could be used for this, since >> all the character keys change the selection in Finder, and all the normal >> modifier keys are used for special functions. So first question is how I can >> differentiate this special mode open from a normal open? > > The Option key is the usual thing. iTunes and iPhoto recognize it at startup, > for example. > >> 2. If the application is started up in this special way, how would I be able >> to detect it, seeing as there is no current event to query? > > I would have said GetKeys(), but it seems to have been deprecated and removed > in the eyeblink [read: decade] since I last used Carbon. There must be some > modern equivalent for reading the current state of the keyboard?
This works in Snow Leopard and Leopard (I believe). - (void)applicationDidFinishLaunching:(NSNotification *)notif { CGEventRef event = CGEventCreate(NULL); CGEventFlags modifiers = CGEventGetFlags(event); CFRelease(event); CGEventFlags flags = (kCGEventFlagMaskAlternate | kCGEventFlagMaskControl); if ((modifiers & flags) == flags) [self doSomethingSpecial]; } Ashley _______________________________________________ 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