I need to share the same NSMenu instance between multiple popup buttons.
When I create an NSPopUpButton in IB, a new menu is automatically created and inserted as a child of the NSPopUpButtonCell.
At the moment, I simply create an IBOutlet NSMenuItem* standardMenu member in my MainController and connect the “menu” outlets of the popup buttons to this, but this leaves the “fake” menus in the hierarchy.
Surely, there’s a clean way of doing this from inside IB?
Thanks in advance for any advice you might be able to give.
You should be able to build a freestanding menu in IB make all the connections, etc. you need. Then create an outlet
IBOutlet NSMenu *standardMenu;that you connect to the menu in IB. Then for each popup that needs the menu just use[popupButton setMenu:standardMenu];. If for some reason it keeps the old items just tell it to remove all items first.