Reputation: 4758
I have an NSButton that when clicked calls [NSMenu popUpMenuPositioningItem:atLocation:inView:]. The menu pops up in the proper location however the topmost NSMenuItem is always highlighted blue, as if the mouse was hovering over it, except that it's not. I can't seem to find any way to control the highlight of an NSMenuItem.
Looking at the screenshot you can see the menu is highlighted even though the mouse is still hovering over the NSButton.
How can I fix this? I don't want anything to be highlighted upon clicking the NSButton.
Upvotes: 0
Views: 593
Reputation: 104082
If you pass nil for the first argument in popUpMenuPositioningItem:atLocation:inView:, then nothing is selected.
Upvotes: 1
Reputation: 96363
Instead of popping up the menu yourself, replace your NSButton with an NSPopUpButton, set to the pull-down type, with the Bordered checkbox turned off (you may have to turn it on and then off again), possibly with the arrow style set to None (although I would leave it in).
Upvotes: 1