Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Document based app question

Document based app question
Thread Tools
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Apr 16, 2002, 10:13 AM
 
How do you stop a Cocoa document based app from creating a new document on startup? I am sure the answer is trivial but I cannot seem to find out how this is done.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 16, 2002, 01:06 PM
 
I think there's an NSApplication delegate method you can use.
     
Forum Regular
Join Date: Jan 2002
Location: Hungary
Status: Offline
Reply With Quote
Apr 16, 2002, 01:39 PM
 
i want to know this as well, so anyone anything specific?
nothing is when everything is alright
stupidfish23@mac.com ICQ: 153647416
     
iJed  (op)
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Apr 16, 2002, 04:18 PM
 
Originally posted by Angus_D:
<STRONG>I think there's an NSApplication delegate method you can use.</STRONG>

Yeah I think there probably is, its just that I can't find it.
     
Fresh-Faced Recruit
Join Date: Apr 2002
Location: Los Angeles, California
Status: Offline
Reply With Quote
Apr 16, 2002, 04:31 PM
 
Originally posted by iJed:
<STRONG>


Yeah I think there probably is, its just that I can't find it.</STRONG>
Take a look at Apple's documentation on Application Architecture

I think you want to implement applicationShouldOpenUntitledFile: in your application delegate. If it returns NO then your app won't create a new untitled document at startup. (Or when the user clicks on your dock icon when no windows are open.)
--
Tim Buchheim
     
iJed  (op)
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status: Offline
Reply With Quote
Apr 16, 2002, 07:15 PM
 
Originally posted by Tim Buchheim:
<STRONG>
I think you want to implement applicationShouldOpenUntitledFile: in your application delegate. If it returns NO then your app won't create a new untitled document at startup. (Or when the user clicks on your dock icon when no windows are open.)</STRONG>

Thanks for the help. Works nicely. Although I should really have seen this myself. I'll blame the Apple Help Viewer which seems to lack a find function for some strange reason...
     
Forum Regular
Join Date: Jan 2002
Location: Hungary
Status: Offline
Reply With Quote
Apr 17, 2002, 04:46 AM
 
yeah, the apple developer documentation certainly needs a search feature....
nothing is when everything is alright
stupidfish23@mac.com ICQ: 153647416
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:48 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2