• 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: Can't keep untitled windows from opening!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't keep untitled windows from opening!


  • Subject: Re: Can't keep untitled windows from opening!
  • From: Carlos Eduardo Mello <email@hidden>
  • Date: Thu, 31 Mar 2011 18:12:36 -0300

Thank you all for the clarifications.
Now I see it didn't really make any sense...
Following Andy's recommendation, I wrote a class to be the app's delegate and handle these calls.
It works fine now.


On Mar 31, 2011, at 1:55 PM, Andy Lee wrote:

No, and if you think about it, it couldn't be. It's possible to launch an app with no documents initially (as you are in fact trying to do) or to have multiple documents open. The app is a singleton object that has exactly one delegate, so the delegate can't be a document instance.

In your main nib, right click the File's Owner (or the Application object) and see if it has a delegate. If so, that tells you what class you should be putting app delegate methods into. If not, you have to create a class -- typically a subclass of NSObject.

--Andy

On Mar 31, 2011, at 12:51 PM, Carlos Eduardo Mello <email@hidden > wrote:

Isn't the document subclass the app's delegate by default in the
document architecture?

On Mar 31, 2011, at 1:36 PM, Gary L. Wade wrote:

> These should be in the app delegate.
>
> - Gary L. Wade (Sent from my iPhone)
>
> On Mar 31, 2011, at 9:25 AM, Carlos Eduardo Mello <email@hidden
> > wrote:
>
>> Hi everyone,
>>
>> I've implemented both methods bellow, but my document-based app
>> still opens untitled windows at start-up and when reactivated from
>> the dock. The methods are placed in the window's delegate
>> (MyDocument.m) but they never get called. Does anybody have an idea
>> why this is happening?
>>
>> - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
>> {
>> NSLog(@"Calling [applicationShouldOpenUntitledFile]...");
>> return NO;
>> }
>>
>> - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender
>> hasVisibleWindows:(BOOL)flag
>> {
>> NSLog(@"Calling [applicationShouldHandleReopen]...");
>> return NO;
>> }
>>
>> Thanks,
>>
>> Carlos.
>>
>>
>> _______________________________________________
>>
>> 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


_______________________________________________

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

_______________________________________________

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: Can't keep untitled windows from opening!
      • From: Quincey Morris <email@hidden>
References: 
 >Re: Can't keep untitled windows from opening! (From: Andy Lee <email@hidden>)

  • Prev by Date: Don't open email from me with no Subject!!!! My email has been hijacked
  • Next by Date: Re: Binding tablecolumn to attribute of specific object in to-many relationship?
  • Previous by thread: Re: Can't keep untitled windows from opening!
  • Next by thread: Re: Can't keep untitled windows from opening!
  • Index(es):
    • Date
    • Thread