Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with setKeyEquivalentModifierMask




On Jun 23, 2006, at 1:27 PM, Scott Mitchell wrote:

I am trying to set my menu items with a user specified Key combination. So they set the key combo they,
the Key String and the modifiers are correct, but when I go to set the Key Code and Modifiers for the
menu item the Key Code is fine, but the modifiers do not show correctly in the menu. No matter what I
do it shows up as the Shift Key modifier in the menu. Below is the code. I have verified and the Key Code
and the Modifiers are correct. Does anyone know why this might not be working? I have searched through the
archives and every thing I have seen looks like what I am doing.


NSString* keyCodeChar = [keyCombo stringForKeyCode];
NSMenuItem* setItem = [[NSMenuItem alloc] initWithTitle:setLabel
												action:@selector(setSelected:)
										keyEquivalent:@""];
[setItem setKeyEquivalentModifierMask:[keyCombo modifiers]];
[setItem setKeyEquivalent:keyCodeChar];

I think you might need to ensure that the keyCodeChar is lowercase before passing it to setKeyEquivalent.


-eric



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Problem with setKeyEquivalentModifierMask (From: Scott Mitchell <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.