• 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: How to not open a new document at app start up (init NSDocument or NSWindowController ?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to not open a new document at app start up (init NSDocument or NSWindowController ?)


  • Subject: Re: How to not open a new document at app start up (init NSDocument or NSWindowController ?)
  • From: Chris Ridd <email@hidden>
  • Date: Fri, 11 Oct 2002 13:06:15 +0100

On 11/10/02 11:03 am, jean-michel daix <email@hidden> wrote:

> Hi !
>
> I've got a Document Based Application and I want the user to choose in a
> preferences panel if a new document should open automatically when launching
> application. My preferences panel works but I don't know how to cancel the
> opening of my document windows.
>
> I try to find a topic in the mailing list but I found nothing so here are my
> questions :
>
> 1) Does somebody know where to find a documentation or a sample code about
> that ?
>
> 2) If not, How to do that ? Should I modify my Document class or Window
> Controller class to cancel the opening ?

Create an object (I called my class AppController and subclassed NSObject)
and implement this method:

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

Instantiate it in your main nib, and make it the delegate of "File's Owner",
ie the application.

This method is described in the NSApplication documentation.

Cheers,

Chris
_______________________________________________
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: 
 >How to not open a new document at app start up (init NSDocument or NSWindowController ?) (From: jean-michel daix <email@hidden>)

  • Prev by Date: Re: Carbon vs Cocoa arguments
  • Next by Date: Resizing question
  • Previous by thread: How to not open a new document at app start up (init NSDocument or NSWindowController ?)
  • Next by thread: Toronto cocoa programmers?
  • Index(es):
    • Date
    • Thread