On Aug 15, 2013, at 2:31 PM, Steve Mills wrote:

> When adding some certain-mode-only menus, we scan the existing menus to 
> temporarily remove key equivs that are also in the new menu. They're put back 
> later. However, something isn't right when I ask for each menu item's 
> modifiers. Our Edit menu has Select All, which is command-a. Another menu to 
> the right of it has an item whose equiv is command-shift-a. Everything's 
> hunky dory with those. Then we go to add the new menu, which also uses 
> command-a. We first find the Select All menu which uses the same equiv, so we 
> remove it. But then it also find the other item which uses command-shift-a. 
> Here's the code that looks for matching equivs:
> 
> if([item.keyEquivalent length] && ([item.keyEquivalent compare:keyToMatch 
> options:NSCaseInsensitiveSearch] == NSOrderedSame) && 
> item.keyEquivalentModifierMask == modsToMatch)
> 
> Both values are very clearly 0x100000, which is only NSCommandKeyMask. But 
> where's the shift key bit? The menu item's mods should be 0x120000. Any ideas 
> about why it's wrong?

Shifted key equivalents which use letter keys are usually represented with 
capital letters, not NSShiftKeyMask.  You're using a case-insensitive match, so 
you're catching those.  Use a case-sensitive match and you should be fine.

Regards,
Ken


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to