• 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
Enabling undo in a CoreData app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enabling undo in a CoreData app?


  • Subject: Enabling undo in a CoreData app?
  • From: email@hidden
  • Date: Sat, 29 Apr 2006 13:05:33 -0700

I have a CoreData app, and I don't want the user to be able to undo almost all actions. So, during my -applicationDidFinishLaunching method, I disableUndoRegistration on my managedObjectContext.

Now, I want to add undo/redo in a couple specific situations. During one method, I am calling this:

NSUndoManager *undoManager = [[self managedObjectContext] undoManager];
[undoManager enableUndoRegistration];
[[undoManager prepareWithInvocationTarget:self] addObjects:validRemovals toCollection:collection];
(If I am not isUndoing, I call -setActionName: here with some appropriate text)
[undoManager disableUndoRegistration];


And during the -addObjects method, I am calling the compliment:


NSUndoManager *undoManager = [[self managedObjectContext] undoManager];
[undoManager enableUndoRegistration];
[[undoManager prepareWithInvocationTarget:self] removeObjects:validAdditions fromCollection:collection];
(If I am not isUndoing, I call -setActionName: here with some appropriate text)
[undoManager disableUndoRegistration];


However, my "Undo" menu item never becomes enabled. Am I being too picky about when I am enabling and disabling registration? (I briefly tried leaving undo registration turned on throughout the application, but the Undo menu item still never became available.)

Any thoughts for how to track down the problem are appreciated.

Thanks,
Blake



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Enabling undo in a CoreData app?
      • From: Jim Correia <email@hidden>
  • Prev by Date: Re: How to access the value that a pointer is pointing to
  • Next by Date: Re: How to access the value that a pointer is pointing to
  • Previous by thread: Re: Distributed objects: Code required on both sides?
  • Next by thread: Re: Enabling undo in a CoreData app?
  • Index(es):
    • Date
    • Thread