I am using a Cocoa Application which has a NSPopupButton. I am adding items to NSPopupButton one by one using NSArray. Now once the users selects an item in the NSPopupButton, I get an event. But the selected item does not move to the top. Instead it is the old item which still sits at the top. Is there a way to move the selected item to the top so the user can see it.
Asked
Active
Viewed 1,140 times
1
-
I have a similar problem. Though, I could not solve it until now. Nonetheless, [you should read here why `indexOfSelectedItem` can be a problem](http://jongampark.wordpress.com/2010/03/14/indexofselecteditem-of-nspopupbutton-in-menudidclose-and-its-action-handler/). – JJD Jan 24 '12 at 17:51
-
Please take a look a this thread since I found [a solution that uses bindings](http://stackoverflow.com/questions/9033872/how-to-retrieve-the-current-selection-of-an-nspopupbuttoncell/9100025#9100025). I also created an [example project](https://github.com/johnjohndoe/NSPopUpButtonCell) which is available on GitHub. I hope that solve your problem as well. – JJD Feb 03 '12 at 14:07