Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSPopUpButton of type pull Down , when i click on some menu item ,title of popup is not getting changed

Problem:

  1. Take an instance of NSPopupButton of type Pull down.

  2. Add few menu items to the pop up.

  3. Run the code.

  4. Select any menu item in the popup

    • Title of popup button is not getting changed.
    • I need to show the selected item as title of Popup same as Normal behaviour of NSPopupButton but with the type pull down.
    • Also Need to add an item as same name as title.

Can anybody help me to achieve this?

like image 554
Neelam Verma Avatar asked Jan 11 '23 19:01

Neelam Verma


1 Answers

From the documentation,

Unlike popup lists, the title of a popup button displaying a pulldown list is not based on the currently selected item and thus remains fixed unless you change using the cell’s setTitle: method.

If you want the selected item to be shown as title, the easiest way is to use a popup instead of pulldown. Or call setTitle: every time you change the selection.

like image 85
revolver Avatar answered Feb 06 '23 19:02

revolver