• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

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.
0
Avik Dasgupta
Asked:
Avik Dasgupta
  • 2
1 Solution
 
brettmjohnsonCommented:
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.

0
 
brettmjohnsonCommented:
Did this work for you?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now