Re: Making an initial change to document, and don't want the doc marked as changed
Re: Making an initial change to document, and don't want the doc marked as changed
- Subject: Re: Making an initial change to document, and don't want the doc marked as changed
- From: Felix Franz <email@hidden>
- Date: Thu, 30 Aug 2007 16:20:41 +0200
On Aug 30, 2007, at 4:04 PM, Graham Perks wrote:
I have some initial document setup that needs doing to a new
document... imagine starting a Pages document from a template, for
example. I don't want all the template instantiation to be
undoable, or to mark the document as needing saving.
How do I do this? This is a Core Data-based application. I've
looked for methods in NSManagedObjectContext and
NSPersistentDocument. NSDocument has updateChangeCount, but it
reads like I should not call it directly.
This is described in the "Core Data Programming Guide: Using Managed
Objects, Undo Management" <http://developer.apple.com/documentation/
Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html#//apple_ref/doc/
uid/TP40001803-207821-TPXREF148>
Example from the documentation:
NSManagedObjectContext *moc = ...;
[moc processPendingChanges]; // flush operations for which you want
undos
[[moc undoManager] disableUndoRegistration];
// make changes for which undo operations are not to be recorded
[moc processPendingChanges]; // flush operations for which you do
not want undos
[[moc undoManager] enableUndoRegistration];
Cheers,
felix
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden