On Jul 26, 2011, at 12:50, Patrick Robertson wrote:
> 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?
Yes, use the constant 0. Or how about "else"?
if ([theEvent modifierFlags] & NSCommandKeyMask)
...
else // use this ...
...
if (([theEvent modifierFlags] & NSCommandKeyMask) == 0) // ... or this
...
...
if (!([theEvent modifierFlags] & NSCommandKeyMask)) // ... or this
...
I'll also point out that you don't want "'no' modifier keys", you want no
*Command* modifier key. Or do you really mean "'no' modifier keys"?
> 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.
Well, of course. You're choosing to use a *modifier* key, which gets pressed
first (and sometimes first by quite a long time), and that modifier is already
used for other things too. That means it's not highly desirable to use the
Command key for modes that are slow to switch or are extremely visible to the
user.
If must use Command, you could certainly try delaying the switch in state, but
that of course makes it seem less responsive.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]