Re: Enabling undo in a CoreData app?
Re: Enabling undo in a CoreData app?
- Subject: Re: Enabling undo in a CoreData app?
- From: email@hidden
- Date: Sat, 29 Apr 2006 16:13:06 -0700
Without knowing the specifics of your situation, I'd suggest that
you don't do this. Having pervasive undo is generally going to lead
to a better user experience.
Well, it's an app that interracts with Flickr, so updating the local
store only has meaning if I also pass those changes back to Flickr.
And that's support that I'm adding right now. So, I really do need to
prevent undo of database changes - as I fetch data from Flickr
periodically or based on user actions and then do all my inserts, I
don't want the user to undo that.
The list of events where the user actually makes a meaningful change
and should be able to undo it is currently very small compared to all
the changes and machinations that the app goes through without the user.
There may be two problems here.
Does the window's delegate return an undo manager (the one for the
managed object context) when asked?
Yes. I left the default template implementation which simply returns
the undo manager from my one Managed Object Context.
Also, you probably don't want to be manually registering undo
actions for CoreData operations. CoreData already manages undo, so
let it. Normally it will process the pending changes at the end of
the current iteration of the event loop. If you have special
needs, you can trigger this manually by sending -
processPendingChanges to the MOC.
This is similar to what I mentioned above - the database action on my
side has no meaning without associated web service calls. Those calls
are not currently 100% built into my model (and I don't think I want
them to be), so a controller object coordinates this. When an "add"
happens, the controller enables undo, makes the changes in the
coredata store, and generates the appropriate web services. Then it
disables undo again.
Some of the control over undo is not ideal, but for the stage my app
is at, it's what needs to happen.
Additionally, if I take out ALL the disableUndoRegistration calls, I
still don't get an enabled Undo menu item - no matter how much I
change my store. And I can ask the undo manager whether undo
registration is enabled, and it replies with YES.
Thanks for the reply,
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