Cocoa programming help

Hi everybody,
           i am building a cocoa application in objective C wherein there is a NSToolbar with different items on it. My problem is that I can't figure out how to associate shortcut keys to those items. I will be extremely thankful if any sort of suggestions are given on how to add a shortcut key association with an NSToolbar item,

Thanking in advance,
Avik DasguptaAsked:
Who is Participating?
brettmjohnsonConnect With a Mentor Commented:
You need to associate an NSMenuItem with the NSToolbarItems that have key equivalents.
You assign a key equivalent using [NSMenuItem setKeyEquivalent:] and [NSMenuItem setKeyEquivalentModifierMask:],  then assign that NSMenuItem to the NSToolbarItem using [NSToolbarItem setMenuFormRepresentation:].  I don't know if this will work if the NSMenuItem is not actually part of a NSMenu, but it would be considered poor UI design if your toolbar actions could not be invoked via the menus anyway.

Did this work for you?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.