Re: Menu shortcuts without modifiers?
Re: Menu shortcuts without modifiers?
- Subject: Re: Menu shortcuts without modifiers?
- From: Peter Ammon <email@hidden>
- Date: Fri, 18 Sep 2009 14:07:03 -0700
On Sep 17, 2009, at 12:29 PM, Uli Kusterer wrote:
Hi,
I have an app that contains a QTMovieView. I've set things up so
people can use the arrow keys to skip, fast forward, rewind, use
space to play/pause etc., as they're used to from other movie-
playing apps. Now, I'd like to add menu items that correspond to
these actions for people who don't know the shortcuts. I'd also like
to show the shortcuts in the menu items, so people know the
shortcuts are there.
Trouble is: If I set e.g. the space key as a menu item's shortcut
and a text field has keyboard focus, the space key goes to the menu,
not to the text field.
I don't want to disable the menu item, as even if there's a text
field with keyboard focus, the user may want to use the menu to
pause etc. Is there a way to make any control get the shortcut
*before* the menus? Is there a way to disable only the shortcut, but
still have it displayed? Is there a way to fake the shortcut, so I
can do the actual handling at a different level? (Carbon lets you
set the menu shortcut glyph separately from the actual shortcut, for
example).
Anyone have an idea for a solution?
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
Hi Uli,
For key events without modifiers, like hitting the spacebar, the first
responder of the key window should get first crack via keyDown:. So
I'm not sure why you're seeing the behavior you describe. I wrote a
quick test with a focused text field in the key window and a main menu
item with Space as its key equivalent, and the text field "won" for
spacebar.
Can you post the backtrace of the call to the action method of your
menu item? It's possible it's being invoked from some place other
than -[NSApplication handleKeyEquivalent:].
_______________________________________________
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