• 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 window for all documents.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One window for all documents.


  • Subject: Re: One window for all documents.
  • From: Darkshadow <email@hidden>
  • Date: Tue, 10 May 2005 08:11:15 -0400


On May 10, 2005, at 2:54 AM, Chaz McGarvey wrote:

Hello:

Program design question: My theoretical app can open files with extension "foo" and I would like to have the benefits of NSDocument. However, I want a single window with an NSTableView to contain a list of "open" documents. This shared window will be used to display information from the file. The list is updated as foo files are opened. In order to edit the file, you double-click an item from the shared window and a document window comes up. So basically, the shared window just sits there display information about the documents that are open, and the other windows are the document windows which need the benefits of NSDocument, like saving. This scenario probably isn't very exciting or innovative.

In order for this to work, an NSDocument has to be able to stay loaded even when it has no windows on-screen for it. The problem is that the NSDocument is automatically released when the 'document' window closes. I could do something like feed it a dummy window controller so it thinks it should stick around, but I've found that whenever I'm tempted to do something ugly like this, there usually is a better, more appropriate way. Any insights? I'm tired.

chaz



Well, you could keep a reference to the file path or URL in the objects that represent opened documents in the table view. Then if the document is closed, don't remove it from the list and double clicking will just have that document open again.


If that won't work for you (maybe it takes a while to open documents or some such thing), I suppose you can just send the window - orderOut: - it'll disappear from the screen but stay around. This'll use more memory, though. If you go this route, you may want to make sure the document gets saved if there are any changes to it before ordering it out, otherwise you may run into issues where if the user tries to quit and a window just suddenly appears asking if changes want to be saved or not.

Darkshadow (aka Michael Nickerson)


_______________________________________________ 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 window for all documents.
      • From: Chaz McGarvey <email@hidden>
References: 
 >One window for all documents. (From: Chaz McGarvey <email@hidden>)

  • Prev by Date: Re: Problem converting pdfs to jpegs with Cocoa & Quartz...
  • Next by Date: Possible NSTokenField bug
  • Previous by thread: Re: One window for all documents.
  • Next by thread: Re: One window for all documents.
  • Index(es):
    • Date
    • Thread