• 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: first document based application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: first document based application


  • Subject: Re: first document based application
  • From: Nathan Wertman <email@hidden>
  • Date: Thu, 3 Apr 2003 00:42:25 -0700

Before creating a new 'untitled' document the NSApplication object will send an "applicationShouldOpenUntitledFile" to it's delegate. From Cocoa Browser:

applicationShouldOpenUntitledFile:

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender

Invoked immediately before opening an untitled file. Return NO to prevent the application from opening an untitled file; return YES, otherwise. Note that applicationOpenUntitledFile: is invoked if this method returns YES.


simply putting the following code into a AppController object (the delegate of the NSApplication for your program) will keep it from loading a new window:

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
return NO;
}


Just make sure that AppController is the delegate of the "File's Owner" object under MainMenu.nib and you should be just fine.

Nate



On Wednesday, April 2, 2003, at 07:53 PM, Greg Hamilton wrote:

Hi,

I'm writing my first document based application. I've used Project Builder to create a new 'Cocoa Document-based application'.

It's a simple viewer for a particular document format and it basically works but, because it's just a viewer I don't want the application to automatically create a new empty document when it starts. I can't work out how to stop this happening.

Greg Hamilton
_______________________________________________
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.
_______________________________________________
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.

References: 
 >first document based application (From: Greg Hamilton <email@hidden>)

  • Prev by Date: Re: Digest API?
  • Next by Date: cc1plus
  • Previous by thread: Re: first document based application
  • Next by thread: Negative Integer in Red in IB
  • Index(es):
    • Date
    • Thread