Take the 2-minute tour ×

I am using an NSPopUpButtonCell in an NSTableView. The popup button has a binding to an NSArray property offered by the ApplicationDelegate. When I select a menu item of the popup button I expect to retrieve the current selection or its index. I added an IBAction to being informed and also set up an NSMenuDelegate. Both return index = 0 at all times.

// indexOfSelectedItem is always 0.
NSInteger indexOfSelectedItem = [m_popUpButtonCell indexOfSelectedItem];

I created an example project with the aforementioned configuration. Hopefully you can clarify things.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The article Implementing To-One Relationships Using Pop-Up Menus answered my question.
I updated the example project.

share|improve this answer
I'm having the same problem. Can you explain what you did? I set the NSPopUpButtonCell's action to a method that simply checks for the selected index ([thePopUp indexOfSelectedItem]), but it keeps returning 0. Do I have to learn how to use bindings? –  Jack Humphries Aug 4 '12 at 22:40
Sorry I missed that you said you updated it. Thanks! –  Jack Humphries Aug 5 '12 at 0:00

Your Answer


