• 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
Re: "How do I get undo/redo for free in my non-document-architecture-based app?"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "How do I get undo/redo for free in my non-document-architecture-based app?"


  • Subject: Re: "How do I get undo/redo for free in my non-document-architecture-based app?"
  • From: mmalc crawford <email@hidden>
  • Date: Mon, 18 Sep 2006 11:39:30 -0700


On Sep 18, 2006, at 10:17 AM, Arthur C. wrote:

In the Core Data FAQ (Core Data Programming Guide 2006-09-05 page 143) there is an item called
"How do I get undo/redo for free in my non-document-architecture- based app?"
It says I can get the undo manager from the managed-object context: "If your window delegate has an accessor method for the managed object context (as is the case if you use the Core Data Application template), your implementation of windowWillReturnUndoManager: might be as follows.
-(NSUndoManager *) windowWillReturnUndoManager:(NSWindow *) sender
{
return [[self managedObjectContext] undoManager];
} "
The question is, where do I have to put this code? Where can I find the 'window delegate'? Is it the 'projectname_Appdelegate.m' file?


To give what is necessarily a circular answer, the window's delegate is whatever object you have set up as the window's delegate. This is typically set up in Interface Builder, and in the Core Data Application template is set up to be the app delegate.


And, isn't it true that the managed object context can be retrieved anywhere using something like
NSManagedObjectContext * managedObjectContext = [[NSApp delegate] managedObjectContext];


*If* you're using the Core Data Application template application *and* you haven't modified it, then yes. But there are of course other application architectures...

As a general point, however, if you do not understand this subject I would recommend not using Core Data until you do. Core Data is not an entry-level technology and builds upon the technologies and patterns that are present in Cocoa -- you should gain a deeper understanding of these first.

mmalc

_______________________________________________
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


References: 
 >"How do I get undo/redo for free in my non-document-architecture-based app?" (From: "Arthur C." <email@hidden>)

  • Prev by Date: Re: Mixing Chinese and Japanese text
  • Next by Date: Re: Internal Compiler error: Bus error
  • Previous by thread: "How do I get undo/redo for free in my non-document-architecture-based app?"
  • Next by thread: wrapping
  • Index(es):
    • Date
    • Thread