Calling an action on pressing the NSPopupButton

I have an NSPopupButton that displays a dropdown menu when clicked. This menu is populated from NSArray. Now if I click on one of the items in the dropdown menu, I can select it and determine what is selected, etc. What I want to do is when the user clicks the NSpopupbutton, refreshes the dropdown and then the user selects one of the items. I am having trouble finding a way to call the IBAction method when I just select the dropdown menu (without clicking any items in it). Clicking an item in the menu results in an IBAction, but I just want to click the down arrow in the NSPopupButton to trigger the action. Any ideas? Thank.


source to share

1 answer

When clicked, it is NSPopupButton

sent NSPopUpButtonWillPopUpNotification

. Have your controller object listen for this notification and respond by updating the dropdown menu.



All Articles