FROM : Gregory Weston
DATE : Sun Mar 02 17:30:12 2008
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.
DATE : Sun Mar 02 17:30:12 2008
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.
| Related mails | Author | Date |
|---|---|---|
| Doug Knowles | Mar 2, 16:29 | |
| Gregory Weston | Mar 2, 17:30 | |
| Scott.D.R | Mar 2, 18:04 | |
| Doug Knowles | Mar 3, 04:49 |






Cocoa mail archive

