• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with setKeyEquivalentModifierMask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with setKeyEquivalentModifierMask


  • Subject: Re: Problem with setKeyEquivalentModifierMask
  • From: Scott Mitchell <email@hidden>
  • Date: Mon, 26 Jun 2006 09:15:56 -0600

Yep, exactly what I was doing wrong. I was converting the Cocoa Menu Modifiers to Carbon Menu Modifiers, so that I could Register them as a Hot key, this was before I decide to add these commands to the menu. When I decided I wanted to add these commands to my menu, I forgot I needed to add them to the menu with the Cocoa Modifiers not the Carbon Modifiers. Once I did that everything works great. Just being a bonehead.



Thanks,
Scott Mitchell
Senior Macintosh Software Engineer
Excelsior Software
http://www.excelsiorsoftware.com


On Jun 24, 2006, at 12:07 PM, Rosyna wrote:

Where are you getting the modifiers from? Do you have a numerical example?

Also note that cocoa, the carbon menu manager, and the general modifier key state APIs have different values for the various modifiers so it depends on what API is generating the keycode and the modifier you are using.

Ack, at 6/23/06, Scott Mitchell said:

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];

--


Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Problem with setKeyEquivalentModifierMask (From: Scott Mitchell <email@hidden>)
 >Re: Problem with setKeyEquivalentModifierMask (From: Rosyna <email@hidden>)

  • Prev by Date: [MEETING] Toronto Area Cocoa & WebObjects Developer Group - July 11
  • Next by Date: Re: objectForKey:self
  • Previous by thread: Re: Problem with setKeyEquivalentModifierMask
  • Next by thread: What is wrong with this code?
  • Index(es):
    • Date
    • Thread