Re: Display selectd sub-menuItem in NSPopUpButton
Re: Display selectd sub-menuItem in NSPopUpButton
- Subject: Re: Display selectd sub-menuItem in NSPopUpButton
- From: Keary Suska <email@hidden>
- Date: Fri, 14 Feb 2014 08:29:08 -0700
On Feb 14, 2014, at 5:02 AM, Leonardo wrote:
> I have filled my NSPopUpButton with menu and submenus.
>
> When I select a menuItem on the root menu (so, not a sub-menuItem), it
> propery displays the menuItem selected. And when I re-click on the popUp
> button, I get the selected menuItem under the mouse.
>
> But if I select a sub-menuItem, it doesn't display it. And if I re-click on
> the popUp button, I don't get it under the mouse. Any time I click on the
> button, I have to look for the selected item diving in the menu hierarchy.
>
> Any solution?
I basic problem is that NSPopupButton does not support submenus. You can get the submenu item title to appear when the menu is dismissed but the side effect is that the item will be added to the top menu. I didn't go any further with that approach. It is too bad, because I would argue that there are good use cases for hierarchical menus in popup buttons.
I don't have any real solutions, however, although I can suggest that you could "hide" the side effect with a "recents" section of the menu. Otherwise you will have to subclass NSPopupButtonCell and take over title and menu handling, AFAICT.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden