Alternative Menu Items in NSMenu

Posted by Nick Paulson on Stack Overflow See other posts from Stack Overflow or by Nick Paulson
Published on 2010-04-09T10:23:55Z Indexed on 2010/04/09 16:53 UTC
Read the original article Hit count: 516

Filed under:
|
|
|
|

Hi,

I have an NSMenu that contains NSMenuItems with custom views. I want it so that when the alt button is pressed, the menu items would change part of their look (through their view). I found setAlternative in the NSMenuItem docs, however, in practice I could only get it to work with NSMenuItems without custom views. As soon as I set a custom view, all of the menu items would be displayed. Also, I tried getting keypress events while the menu was open. Due to the other run loop, NSApplication's sendEvent: doesn't receive events until after the menu is closed. Therefore, I can't just intercept the event coming in.

Does anyone know how I can get notified, whether through delegation or subclassing, of when the alt key is pressed when a menu is opened?

© Stack Overflow or respective owner

Related posts about nsmenu

Related posts about nsmenuitem