re: Correct way to have nil undo manager in Core Data document?
re: Correct way to have nil undo manager in Core Data document?
- Subject: re: Correct way to have nil undo manager in Core Data document?
- From: Ben Trumbull <email@hidden>
- Date: Sat, 29 Aug 2009 17:29:31 -0700
Well, I've got a background worker process which opens an
NSPersistenDocument. Since it has no "undo" capability, I want to set
it to nil as recommended. (I have other reasons for not wanting an
undo manager scurrying around.) But the document doesn't like having
nil undo manager. When I ask for it later, it creates one for itself,
and sets its managed object context to have the same one.
You need to use the NSDocument API:
/* The document's undo manager. The default implementation of -
setUndoManager:, in addition to recording the undo manager, registers
the document as an observer of various NSUndoManager notifications so
that -updateChangeCount: is invoked as undoable changes are made to
the document. The default implementation of -undoManager creates an
undo manager if the document does not already have one and -
hasUndoManager would return YES. */
- (void)setUndoManager:(NSUndoManager *)undoManager;
- (NSUndoManager *)undoManager;
/* Whether or not the document has an undo manager. The default
implementation of -setHasUndoManager: releases the document's current
undo manager if it has one before the invocation but is not to have
one afterward. */
- (void)setHasUndoManager:(BOOL)hasUndoManager;
- (BOOL)hasUndoManager;
- Ben
_______________________________________________
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