• 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: NSDocumentController singleton problem, part 2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocumentController singleton problem, part 2


  • Subject: Re: NSDocumentController singleton problem, part 2
  • From: Brad Oliver <email@hidden>
  • Date: Fri, 03 Jan 2003 15:29:53 -0600

On 12/20/02 11:59 AM, "Mike Ferris" <email@hidden> wrote:

> I would start by overriding NSDocumentController's -openDocument: and
> -newDocument: to do nothing if you don't want a new document (and maybe
> -validateMenuItem: to not allow the menu choices to even be enabled
> when you can't handle them.
>
> That covers the menu commands. Pretty much all other means of opening
> a new document (double-clicking, AppleScript, etc...) will consult the
> app delegate if it implements -application:openFile:. So you can
> implement that. If you decide to allow the open, simply call
> NSDocumentController's --openDocumentWithContentsOfFile:display:,
> otherwise don't. And probably return YES either way since not opening
> a document in your case is not an error, but a "feature".

Just to follow up, this works perfect for my needs as described, with one
caveat. I needed to call back into NSDocumentController from my document
dealloc routine to finish the second half of the open/new process, otherwise
I got into a position where I had two documents present in the document
controller for a brief period, which confused some other code in my app.

Thanks all for the tips and advice!

--
Brad Oliver
email@hidden
_______________________________________________
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.

  • Prev by Date: Re: smooth resize
  • Next by Date: Modify keychains with Keychain Services
  • Previous by thread: Re: smooth resize
  • Next by thread: Modify keychains with Keychain Services
  • Index(es):
    • Date
    • Thread