Re: Issue about cocoa Multi-document template
Re: Issue about cocoa Multi-document template
- Subject: Re: Issue about cocoa Multi-document template
- From: Gregory Weston <email@hidden>
- Date: Sun, 2 Mar 2008 11:30:12 -0500
Scott.D.R wrote:
Hi everyone.
I want to start an application with the cocoa multi-document template.
The default behavior of the application is when you launch it, a blank
window is automatically open.
This behavior is not that I want. I thought the application should not
open any window until users explicit open file command arrived.
That's not the standard behavior of document-centric Mac OS X
applications. The standard behavior is to present the user with a
new, empty document when the app is launched by double-clicking the
app icon or when it's activated by clicking the dock icon while no
documents are open. So my first recommendation is to understand that
and decided if you really need to deviate.
So, is there any way to disable the application to open the window
when launched? Thank you for any help.
In general in Cocoa, when you're looking to tweak the behavior of the
application object, the place to look is the application's delegate.
One of NSApplication's delegate methods is
applicationShouldOpenUntitledFile:. You'd want to override that to
decide whether you want to open a new document and return the result
of that decision.
_______________________________________________
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