On 2/15/11 6:11 PM, Kyle Sluder wrote:
On Tue, Feb 15, 2011 at 5:40 PM, Randy Widell<bornagainsl...@gmail.com>  wrote:
I am trying to wrap my mind around something and the Apple docs are just not
helping.  I am not sure if I am looking in the wrong places or what, but I
am just not getting it.

Binding a menu item to First Responder and setting a key equivalent for the
menu item is trivial.

However, what if I want a key equivalent for a command that is not in a
menu?
The canonical answer is, "You make a menu item for it."

I am approaching this from years of Windows experience (which is probably
part of the problem), so I am looking for something similar to an
accelerator table.  I essentially duplicated this idea by overriding
performKeyEquivalent: in a view, iterating through a table looking for a key
code and modifier flag match, then performing that action.

This "works", but I would have to duplicate this in every view that handles
that command.
Would you mind elaborating on the action you're trying to provide a
shortcut for?

I have a view displaying waveforms. I would like to have a keyboard shortcut that tags a location on the waveforms at the location of the mouse cursor. These commands do not make any sense in the main menu...they could go there, but they would be clutter.

I just tried adding a context menu to the view's XIB, assigning the key equivalents, and assigning the context menu to the view's menu outlet. The commands work if you use them via the menu, but the key equivalents did not work. Using a context menu is too slow for the number of tags that generally need to be added anyway.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to