• 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: Issue about cocoa Multi-document template
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Issue about cocoa Multi-document template
      • From: "Doug Knowles" <email@hidden>
  • Prev by Date: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView
  • Next by Date: Re: [NSOutlineView] How to know an item is expanded if its parent item is not?
  • Previous by thread: Re: Issue about cocoa Multi-document template
  • Next by thread: Re: Issue about cocoa Multi-document template
  • Index(es):
    • Date
    • Thread