On Jun 3, 2008, at 8:57 PM, Jerry Krinock wrote:

I use an NSOutlineView. I have implemented an action, myAction, which is targetted by a main menu item, which is in turn assigned the keyboard shortcut cmd+upArrow.

In some situations, myAction is not allowed, so -validateMenuItem: in my window controller subclass returns NO. I see that - validateMenuItem: is invoked whenever the menu is displayed, and it is also invoked whenever cmd+upArrow is typed.

When validateMenuItem: returns NO for myAction, the menu behaves as expected: Item is disabled. And when I run my app in Mac OS 10.4.11, the keyboard shortcut behaves as expected: NSBeep with no action.

But running in 10.5.3, upon typing cmd+upArrow, when - validateMenuItem: returns NO, there is no NSBeep and instead a different action happens: The selection is moved up. Of course, this is the action that NSOutlineView normally performs in response to upArrow without the cmd key modifier.

So, it's like NSOutlineView steps in and says, "So sorry he couldn't do what you want, but here's a similar action of mine you might like!"

Is this a bug or a feature? I've read through the "Numerous NSTableView and NSOutlineView enhancements" in the Leopard AppKit Release Notes [1] but can't find this one.

Feature!

First off, great job reading the release notes. That makes me happy!

Second, I suggest reading them further :)

http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSMenu

Disabled key equivalents passed throughPrior to Leopard, key equivalents corresponding to disabled menu items would be ignored. In Leopard, your application now has a chance to handle these. For example, a key equivalent for control-K on a disabled menu item will no longer block the emacs shortcut in an NSTextView, in Leopard.



-corbin
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to