• 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
performKeyEquivalent is finding the wrong menu item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

performKeyEquivalent is finding the wrong menu item


  • Subject: performKeyEquivalent is finding the wrong menu item
  • From: Steve Mills <email@hidden>
  • Date: Fri, 04 Oct 2013 15:55:58 -0500

We have a menu that has one submenu with an item that uses unmodified 7, then another submenu with an item that uses control-7. When control-7 is typed, Cocoa is finding the item with unmodified 7 instead of the item with control-7. If I trap this event in our app's sendEvent: method and make a new event withOUT the device-dependant flags in the modifiers, then it works correctly:

	newEvent = [NSEvent keyEventWithType:NSKeyDown
		location:event.locationInWindow
		modifierFlags:event.modifierFlags & NSDeviceIndependentModifierFlagsMask
		timestamp:event.timestamp
		windowNumber:event.windowNumber
		context:event.context
		characters:event.characters
		charactersIgnoringModifiers:event.charactersIgnoringModifiers
		isARepeat:event.isARepeat
		keyCode:event.keyCode];

	[super sendEvent:newEvent];

The modifiers for the event we get from the OS is 0x00040101. Is this just a bug in NSMenu's key equiv matching algorithm? If I set the lower submenu's item to use control-a, and a higher submenu's item already handles unmodified a, then it works correctly and control-a goes to the lower item. So there's something weird with number keys. I'm not using numpad keys in any part of this particular problem.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Prev by Date: Re: How to get variably sized header in a UICollectionView supporting both orientations
  • Next by Date: Re: Autolayout fixed size centering in VFL
  • Previous by thread: Re: Autolayout fixed size centering in VFL
  • Next by thread: Re: Migrating Core Data models
  • Index(es):
    • Date
    • Thread