• 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
NSPersistentDocument initialization and NSUndoManager
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPersistentDocument initialization and NSUndoManager


  • Subject: NSPersistentDocument initialization and NSUndoManager
  • From: Frank Illenberger <email@hidden>
  • Date: Wed, 1 Jun 2005 11:41:42 +0200

I am writing a NSPersistentDocument application. The managedDocumentContext of a newly created document should be populated with a root object but this creation should not be undoable by the user.
Therefore I implemented initWithType:error: in NSPersistentDocument:

- (id)initWithType:(NSString *)typeName error:(NSError **)outError
{
    self = [super initWithType:typeName error:outError];
    if(self != nil)
    {
        NSManagedObjectContext *mc = [self managedObjectContext];
        [[mc undoManager] disableUndoRegistration];
        base = [[NSEntityDescription insertNewObjectForEntityForName:@"Base" inManagedObjectContext:mc] retain];
        [base setTitle:[self displayName]];
        [[mc undoManager] enableUndoRegistration];
    }
    return self;
}

But the undo manager seems to ignore that I disabled the undo registration while creating the base object: After the second click into the "Edit" menu, the "Undo" menu item is enabled and the user can undo the creation of the base object.

Is this a bug in Cocoa/CoreData or am I doing something wrong?


Regards


 Frank


 _______________________________________________
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: NSPersistentDocument initialization and NSUndoManager
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Problem filing modified Sketch objects (Newbie)
  • Next by Date: Re: Pasteboard inspector?
  • Previous by thread: Re: Problem filing modified Sketch objects (Newbie)
  • Next by thread: Re: NSPersistentDocument initialization and NSUndoManager
  • Index(es):
    • Date
    • Thread