Avoid creating a new document when launching an application
-
I have a Document-based application (NSPersisentDocument to be precise) for
which I would like to override the default behavior when launching: I'd like to
avoid creating a new blank document (for example by displaying an open dialog).
How can I do this? What should I override? (Of course, the file:"new" command
should still work)
Bruno -
On Oct 15, 2005, at 4:45 PM, <lists...> wrote:
> I have a Document-based application (NSPersisentDocument to be
> precise) for
> which I would like to override the default behavior when launching:
> I'd like to
> avoid creating a new blank document (for example by displaying an
> open dialog).
>
> How can I do this? What should I override? (Of course, the
> file:"new" command
> should still work)
In your application delegate, implement -
applicationShouldOpenUntitledFile:
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org -
On Oct 15, 2005, at 1:45 PM, <lists...> wrote:
> I have a Document-based application (NSPersisentDocument to be
> precise) for
> which I would like to override the default behavior when launching:
> I'd like to
> avoid creating a new blank document (for example by displaying an
> open dialog).
>
Add this method to your app's delegate.
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
[[NSDocumentController sharedDocumentController]
performSelector:@selector(openDocument:) withObject:self afterDelay:
0.1];
return NO;
}
_murat



