• 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
RE: bindings and undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: bindings and undo


  • Subject: RE: bindings and undo
  • From: Mark Onyschuk <email@hidden>
  • Date: Fri, 16 Apr 2004 09:18:25 -0400

Can't see how there's any sort of problem with bindings and undo. As per normal, put your undo code into your model and you'll find that bindings automagically follow the execution of undo/redo as provided by NSUndoManager.

The controller layer continues to use the same accessors that pre-binding-layer code would have in past. Specifically, accessor methods like this:

- (void)setFoo:(id)newFoo
{
if (![foo isEqual:newFoo]) {
[[self undoManagerWithTarget:self] setFoo:foo];

[foo release];
foo = [newFoo copyWithZone:[self zone]];
}
}

...so undos are registered in the same-old-same-old way even though now they're triggered by bindings.

And because undo manager style redo's typically call through accessors as well, and key-value-observing watches these sorts of things, your interface will be updated in the same way it would if you simply called [myObject setFoo:someNewFoo] by hand...

I've briefly scanned through the archives, and best I can tell, complaints about undo have mostly to do with "transaction" support as supplied by the old EOF "editing context" concept which allowed for atomic (ie. undoable), grouped updates of object graphs. Outside of DB applications, that's not really germane to most run-of-the-mill Cocoa coding.

-Mark
_______________________________________________
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: bindings and undo
      • From: m <email@hidden>
  • Prev by Date: CreateQDContextForCollapsedWindowDockTile does not work in a cocoa context
  • Next by Date: Re: Compiling NSAppleScript with getuid = 0
  • Previous by thread: Re: Slider value display
  • Next by thread: Re: bindings and undo
  • Index(es):
    • Date
    • Thread