Skip navigation.
 
mlNSTableView, undo, bindings
FROM : m
DATE : Sat Nov 06 23:22:21 2004

I have a table view bound to an array controller. The model is an array
of dictionaries. The values in the dictionaries can be edited by double
clicking in a table cell and changing the text. That all works very
nicely.

I'm trying to figure out the most straightforward way to implement
undo. I tried overriding the array controller's
observeValueForKeyPath:ofObject:change:context: method, and it does get
called when the user changes a data value in the table, but the change
dictionary argument is always nil, so I don't know what the "before"
value of the data was.

Whether a change dictionary is passed to the array controller's
observeValueForKeyPath:ofObject:change:context: method depends on the
options passed to the dictionary's
addObserver:forKeyPath:options:context: method when the controller
registered as an observer. Is there some way to change the observer
options after the observer relationship is established? Or am I going
about this in completely the wrong way?

_murat

Related mailsAuthorDate
mlNSTableView, undo, bindings m Nov 6, 23:22
mlRe: NSTableView, undo, bindings Theodore Petrosky Nov 7, 14:29