Re: NSArrayController and undo row add/remove
Re: NSArrayController and undo row add/remove
- Subject: Re: NSArrayController and undo row add/remove
- From: Allan Odgaard <email@hidden>
- Date: Mon, 26 Apr 2004 11:25:33 +0200
On 26. Apr 2004, at 7:46, Ashley Clark wrote:
[...] What appears to be called is
removeObjectsAtArrangedObjectIndexes. But even what it does seems
inconsistent, sometimes it calls removeObjectAtArrangedObjectIndex and
other times, I don't know what it does, it just seems to magically
remove the items. Any ideas on what to override or am I looking in the
wrong place?
There is at least 4 methods to remove objects, neither are guaranteed
to be used by the simpler "remove:" method.
Assuming that the contentArray binding of your array controller is
bound to a key in your model, I would either
a) implement the to-many accessor methods
<
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Protocols/NSKeyValueCoding.html#//apple_ref/doc/uid/
20000471/BABJFEAE> and place the undo/redo logging there
b) add an observer to the key path of the array, which logs the
changes as they are observed -- unfortunately for option b to work, the
change dictionary must contain the old attribute value when receiving a
NSKeyValueChangeRemoval notification, and the presence of this depends
on how the mutableArrayValueForKey: is able to construct the proxy, and
is anyway undocumented -- so option a would seem to be the way to go.
--
et al: used as an abbreviation when referring to a number of people, for
example: "It has been improved by Knuth et al." [syn: and others, et
alii]
etc: continuing in the same way [syn: and so forth, and so on, et
cetera].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.