• 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: Best Practice for implementing NSUndoManager?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best Practice for implementing NSUndoManager?


  • Subject: Re: Best Practice for implementing NSUndoManager?
  • From: Luke Tupper <email@hidden>
  • Date: Wed, 9 Jun 2004 06:21:29 +1000

>Luke,
>
>The link to your sample app didn't work for me so I will just give
>you my thoughts on the 2 questions that you posed (in so far as I
>understand what you wrote):

Not sure what is going on there, Firefox downloads it ok but safari
doesn't. I have renamed the file .sit and safari downloads it ok.
Here is the new link: http://www.tupps.com/cocoa/UndoExample.sit


>>1) Should the model or the controller add objects to the undo
>>manager?
>
>Considering 'reuse' issues, I would say that the model should not
>have any knowledge of an undo manager and would opt for the
>controller.

I will have to have another dig through the documentation. It seems a
little bit tougher to fit the undo manager around methods such
takeValue: forKey: when inside the table datasource methods.

[existingData takeValue:anObject forKey:identifier];

But my guess this problem is simply because I worked out how to use
the simple undo but not the Invocation-Based system. The other option
is that my example is just to simple and I have blended some of the
controller code with the model and some of it with the view.

Thanks for your time.

Luke


>
>>2) If I am on the right track with question 1, then question 2 is:
>>How should you propagate the NSUndoManager within the app? At present
>>I am passing the NSUndoManager to objects during the initialization
>>of the object, is there an easier or more elegant way to do this?
>
>
>For this, you could try something like:
>
>[[[NSDocumentController sharedDocumentController] currentDocument]
>undoManager];
>
>
>Sean
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Best Practice for implementing NSUndoManager? (From: Sean Todd <email@hidden>)

  • Prev by Date: Re: / NSFileHandle in rtf and mpg files /
  • Next by Date: Re: Panther's NSScreen vs. screen resolution changes
  • Previous by thread: Re: Best Practice for implementing NSUndoManager?
  • Next by thread: Re: Best Practice for implementing NSUndoManager?
  • Index(es):
    • Date
    • Thread