• 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: one document at a time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: one document at a time


  • Subject: Re: one document at a time
  • From: Jeff LaMarche <email@hidden>
  • Date: Tue, 14 Dec 2004 17:22:18 -0500

On Dec 14, 2004, at 5:07 PM, Jiri Volejnik wrote:

I need to modify my app so that only one document at a time can be opened. If there is some document already opened, it should be closed and its windows reused. What way would you suggest to go? I was thinking about subclassing NSDocumentController, but maybe it's not necessary?

Well, before anything, I'd suggest you think through this. As an end user, I find the one-document restriction annoying in most applications that use it. I have trouble seeing why Quicktime Player allows multiple movies, but Windows Media Player allows only one, for example. There are some cases where it seems to make sense, though.


So, if you're sure it's the right thing to do, I would suggest that the easiest thing is to simply gray the "new document" menu item when a document is opened or created, and enable it when there a document is closed. With the "open document" option, you should ask to save, close without saving, or cancel before presenting the standard open dialog.

This requires a relatively minimal amount of code, and is fairly easy to back out should you decide to support multiple documents in the future.


_______________________________________________ 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: one document at a time
      • From: Jiri Volejnik <email@hidden>
    • Re: one document at a time
      • From: Jonathon Mah <email@hidden>
References: 
 >one document at a time (From: Jiri Volejnik <email@hidden>)

  • Prev by Date: one document at a time
  • Next by Date: Re: toll free bridging
  • Previous by thread: one document at a time
  • Next by thread: Re: one document at a time
  • Index(es):
    • Date
    • Thread