Hi all, I'm wanting to toggle an object between its default and 'alternate' state (the object is made up of an image and some text) when the user hits the command (⌘) key. An obvious example is in Xcode 3.2 where if you press ⌥ the 'Build and Run' icon and text changes to 'Build and Debug' (or vice versa, depending on your breakpoints)
The object is in a custom view which is a sub (sub) class of NSControl → NSView etc. etc. I assumed I'd be able to use - (void)flagsChanged:(NSEvent *)theEvent { if ([theEvent modifierFlags] &NSCommandKeyMask) { // change the image } // when keys are lifted so there are no modifiers if ([theEvent modifierFlags] & **NSNoKeys**) { // set the image back to the original } } but have come across a few problems. First, you can see from the code that I can't seem to find a mask for when 'no' modifier keys are pressed. This method does get called for key downs and key ups. It seems 'no keys' corresponds to 0x100, but is there no constant I can use? Secondly, this method seems to get called when other key combos are pressed (e.g. ⌘S or ⌘Q). This means the object/image will flick back/forward, which isn't entirely desirable. Any suggestions would be greatly appreciated. Thanks _______________________________________________ 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