Please give me an advice how to implement this kind of disclosure button as on my screenshot - a disclosure "arrow down" button displaying a menu on click:
I've tried two approaches, using NSPopupButton
and NSButton
with disclosure style and manual menu displaying:
NSPopupButton
keeps displaying default value text and can't be resized in Interface Builder to a narrow size.
NSButton
displays a menu, but it's obviously misplaced to the point where I click the button, not at the bottom edge. I'm using the following code:
- (IBAction)handleShowMenu:(id)sender
{
[NSMenu popUpContextMenu:profileMenu
withEvent:[NSApp currentEvent]
forView:sender];
}
So what's the right way to display such a menu?
I've managed with it! The correct setup is to use NSPopupButton
with "No Arrow" and "Disclosure" bezel style, "Momentary Push In" type.