So awhile back I made a cocoa widget that was a button that when pressed, would pop up a popup menu and handle the selection. This was quite trivial using the NSPopupMenuButton class but now I need to do something slightly different. I have an openGL widget and when I click on a certain part of this widget, I need to pop up the same pop up menu that you get from the NSPopupMenuButton but without the button. I could not find any reference to this menu class itself inside the documentation for the NSPopupMenuButton. Is what I am trying to do possible? Or do I need to build this pop up menu from scratch?
views:
132answers:
1
+2
A:
There is no separate NSPopUpMenu. The menu of an NSPopUpButton is an NSMenu.
If you want a pop-up menu without a pop-up button, you'll need to use NSPopUpButtonCell to display the menu. Of course, this is assuming you have a good reason to fake a pop-up button in an OpenGL view, instead of simply using the standard NSPopUpButton.
Peter Hosey
2009-12-11 07:06:44