• 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: Document architecture - stop it from opening untitled documents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document architecture - stop it from opening untitled documents?


  • Subject: Re: Document architecture - stop it from opening untitled documents?
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 10 Oct 2009 02:05:12 -0500

On Oct 9, 2009, at 8:57 PM, aaron smith wrote:

On Fri, Oct 9, 2009 at 6:52 PM, aaron smith
<email@hidden> wrote:
Hey All, quick question.

I'm trying to figure out how to stop untitled documents from opening
when the application first runs. I've been looking on google, and
tried some different combinations of method overrides on
NSDocumentController. I figured out how to stop the untitled doc from
opening, by overriding "- (id)makeUntitledDocumentOfType:(NSString
*)typeName error:(NSError **)outError", but the problem is that it's
required to give it an NSError, which is fine. But the the application
automatically opens up an alert error.


if anyone has a quick pointer in the right direction that would be awesome.

Thanks.


ok. nevermind. I got it.

You have to implement a method from NSApplicationDelegate:

- (BOOL) applicationOpenUntitledFile:(NSApplication *) theApplication {
return true;
}

Better to implement:

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

That expresses that the application shouldn't open an untitled document, rather than it thinking it should and you faking success.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Document architecture - stop it from opening untitled documents?
      • From: aaron smith <email@hidden>
References: 
 >Document architecture - stop it from opening untitled documents? (From: aaron smith <email@hidden>)
 >Re: Document architecture - stop it from opening untitled documents? (From: aaron smith <email@hidden>)

  • Prev by Date: Re: Binding to currently selected object in a list?
  • Next by Date: re: [iPhone} Exception After Creating First Object
  • Previous by thread: Re: Document architecture - stop it from opening untitled documents?
  • Next by thread: Re: Document architecture - stop it from opening untitled documents?
  • Index(es):
    • Date
    • Thread