On Sep 11, 2012, at 3:27 PM, Christian Schmitz <[email protected]> 
wrote:

> 
> Am 11.09.2012 um 14:46 schrieb Gavin Smith <[email protected]>:
> 
>> I am trying to implement keyboard shortcuts on NSStatusItems but I can't 
>> figure out how. The StatusItem example app has .keyequivalent set and you 
>> can see the shortcut in the menu but I'm not sure if this has been 
>> implemented - maybe it's just for an example?
>> 
>> I would appreciate any help in getting keyboard shortcuts working with 
>> NSStatusItems.
> 
> 
> You can try like this:
> 
> 
> a.keyEquivalent = encodings.UTF8.Chr(NSEventMBS.NSF6FunctionKey)
> a.keyEquivalentModifierMask = NSEventMBS.NSCommandKeyMask
> 
> this works for me and shows command F6 in the menu and menu item action is 
> executed when the app is frontmost.
> 
> For background, you'd need something like CarbonHotKeyMBS class.

Yes, I have been researching further since I posted - I thought an NSStatusItem 
keyboard shortcut would have done, even if the app was background but of course 
it doesn't. Would CarbonHotKeyMBS still be allowable on the Mac App Store? I 
was hoping for a nice Cocoa solution, such as 
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html

Gavin
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to