Welcome page in doc-based app

Nibbie
Posts: 4
Joined: 2009.09
Post: #1
I'm having some problems with document-based apps.. well, i managed to set up the app, using a window controller for the doc's window, and in that window i have some panels serving as inspectors, and now i realised i missed something!


I need some help for the following issues:

1) i want to make a splash screen (a window that appears when you open the app and loads some settings, like photoshop)

2) after the splash screen loads all the settings needed by the app, i don't want the app to load a new document.. could i change this behaviour ? why do i want that ? well, i want to load a window that shows the user some recent documents and a link for making a new document, so the user will create the new document, not the app (like dreamweaver's "welcome" page that shows up when the app has started, hides when the user chooses to create/open a document, and shows back up when the user closes all open documents)... i just need some guidelines, some hints on how i could do that..


Is it possible to make these things in a doc-based app ? or do i have to make a window based app and hardcode it to simulate a doc-based app ?
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #2
There's really nothing different between a document based app and one that isn't. The difference is that in one, you use the document classes and in the other, you simply don't.

All you need to do is implement some of the NSApplication delegate methods such as applicationWillFinishLaunching: and applicationOpenUntitledFile: and do the appropriate logic there since those are called at the times you need.
Quote this message in a reply
Moderator
Posts: 623
Joined: 2007.09
Post: #3
A look at this might help you out: http://oreilly.com/pub/a/mac/2002/06/14/cocoa.html

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2009.09
Post: #4
Hairball183 Wrote:A look at this might help you out: http://oreilly.com/pub/a/mac/2002/06/14/cocoa.html

wow, i've read so many mac dev books, but this one slipped through my fingers! thanks mate, really appreciate it! you're a life saver!
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2009.09
Post: #5
Hairball183 Wrote:A look at this might help you out: http://oreilly.com/pub/a/mac/2002/06/14/cocoa.html

btw, what's the name of the book from that link you gave me ?
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2009.09
Post: #6
hmm, i've stumbled across another problem... i managed to load a welcome window at every startup of the app, the user can open multiple documents of different types, but now i wanna catch some kind of event that triggers when the user closes the last opened document so that i can redisplay the welcome window.. is there such an event ? or do i have to override the document's canCloseDocumentWithDelegate method where i would check if it's the last opened document ? (and if so, how do i check if it's the last opened document ?)
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #7
I'd override the NSDocumentController removeDocument: method, but personally I'd advise against reopening the welcome window immediately after the document is closed.
Quote this message in a reply
Post Reply