Observing changes in TableView


Gerriet M. Denkmann
 

macOS 12.6

I have an ArrayController which has ContentArray bound to AppDelegate.contentArray
The contentArray contains MutableDictionaries with a key “Flag”, value: boxed BOOL.

And a TableView which has Content bound to ArrayController arrangedObjects.

The TableView (View based) has a TableColumn which has s Button in Table Cell View.
Its Value is bound to: Table Cell View.objectValue.Flag

Everything works fine, but now I want to get notified when the user clicks on some Button in the TableView (and thus changes Flag in some dictionary inside contentArray).

I seem to remember that on can not observe changes inside contentArray.

So I gave the Button a target and action, but this never results in a message sent.

How can I accomplish this?

The best (not very good) I can think of is a timer which every half second checks all dictionaries in contentArray.
Very wasteful indeed.

There surely must be a better way.


Gerriet.

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.