• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSArrayController and undo row add/remove
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController and undo row add/remove


  • Subject: NSArrayController and undo row add/remove
  • From: Ashley Clark <email@hidden>
  • Date: Mon, 26 Apr 2004 00:46:42 -0500

I've been experimenting with the Controller objects and trying to
implement undo support with them and run up against a snag. I've
subclassed NSArrayController so I can get at the document's
undoManager. This seemed like a good place to register the addition and
removal of rows with the undo manager but it doesn't seem to be
working.

- (void)addObject:(id)object {
[[[document undoManager] prepareWithInvocationTarget:self]
removeObject:object];

[super addObject:object];
}

- (void)removeObject:(id)object {
[[[document undoManager] prepareWithInvocationTarget:self]
addObject:object];

[super removeObject:object];
}

Now, I've got two buttons bound to add: and remove: of my subclassed
ArrayController. When I add a row it adds an entry to the undo stack to
remove the row but if I remove a row, no entry is added. Obviously my
method's not being called. 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?

Ashley Clark

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSArrayController and undo row add/remove
      • From: Don Briggs <email@hidden>
    • Re: NSArrayController and undo row add/remove
      • From: Allan Odgaard <email@hidden>
  • Prev by Date: Re: Standard User Defaults - Setting initial values
  • Next by Date: Re: xCode 1.2
  • Previous by thread: Re: Internet Browsers.
  • Next by thread: Re: NSArrayController and undo row add/remove
  • Index(es):
    • Date
    • Thread