• 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
Problem with unicode keyEquivalents in MenuItems?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with unicode keyEquivalents in MenuItems?


  • Subject: Problem with unicode keyEquivalents in MenuItems?
  • From: j o a r <email@hidden>
  • Date: Fri, 22 Mar 2002 01:29:29 +0100

Hello,

Should I expect to have problems with assigning keyEquivalents to MenuItems that aren't plain old 7-bit ASCII?

I have a test application where I attempt to change the keyEquivalent for a standard menu. If I assign CMD-y, or any other plain alphanumeric key, it works fine. But any attempt to assing a Function Key, or page up, page down, et.c. fails. Actually, assigning the key equivalent is easy - and the menu item properly updates with a nice little image representing the key I choosed - but pushing the key doesn't trigger the action.

The Cocoa documentation, and comments from Apple employees on the lists, seems to suggest that it should work - but it does not in my case, and I cannot understand why.

In an attempt to understand what's happening I have posed as NSMenu, and using log output I can tell that the main menu does indeed get asked to find a menu item for the key when pressed (sample log output included at the end of this email). Similarly I can also tell that the menu item in quesiton does have that same key assigned.

My best guess is that since the more exotic keys that are represented as unicode characters - like "\\uf708" for F5 - the menu fails to find them when it searches it's hierarchy of menu items for a match. Does that make any sense?

If I use a subclass of NSMenu and pose as NSMenu and override "performKeyEquivalent:" with a method where I implement my own search through the menu items it works fine - ie. I can easily find the menu item and can call the action as expected.
Is there any danger in "solving" the problem in that way? I guess what I'm asking is: "Is 'performKeyEquivalent:' responsible for anything else besides looking for a matching keyEquivalent and releasing it's action on it's target (or the first responder)"?

Thank you in advance for any hints and pointers to TFM!

Regards,

j o a r


MyMenu.performKeyEquivalent: \\uf708, F5
menu item: ,
menu item: About NewApplication,
menu item: Preferences...,
menu item: ,
menu item: Services,
menu item: ,
menu item: Hide NewApplication, h
menu item: Hide Others,
menu item: Show All,
menu item: ,
menu item: Quit NewApplication, q
menu item: File,
menu item: New, n
menu item: Open..., o
menu item: Open Recent,
menu item: Clear Menu,
menu item: ,
menu item: Close, w
menu item: Save, s
menu item: Save As..., S
menu item: Revert,
menu item: ,
menu item: Page Setup..., \\uf708
menu item: Page Setup...
menu item: ,
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Can't get Help to work
  • Next by Date: Re: isKindOfClass vs. loading bundles: nope?!?!?!?
  • Previous by thread: Re: sizeToFit
  • Next by thread: Checkbox starts click and doesn't do what it should
  • Index(es):
    • Date
    • Thread