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 protected])
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 [email protected]