Search code examples
macoscocoanspopupbuttoncell

NSPopupButtonCell listen for selected index changed


I have the following requirement and struggle to implement it:

I have an NSTableView that is bound to an Array. One column of the table is a NSPopupButtonCell. Everything works with the NSPopupButtonCell writing data back to the underlying array and so forth.

The requirement is that if I have for example 10 rows selected and change the entry of the NSPopupButtonCell for one row, it should apply the same to all of the other selected rows.

I was trying to implement an event that would listen to when the NSPopupButtonCell changed value and then apply it to the rest of the selected items but no luck.

Do you have any suggestion how to solve this ? How can I listen to the NSPopupButtonCell change ?

thanks a lot.


Solution

  • What did you actually try?

    It should work to simply use target-action. Connect the NSPopUpButtonCell's action to a target and selector. Most likely you would use the view controller or window controller as the target.