Re: Open new document from within another document.
Re: Open new document from within another document.
- Subject: Re: Open new document from within another document.
- From: Quincey Morris <email@hidden>
- Date: Mon, 11 Jan 2010 09:41:15 -0800
On Jan 11, 2010, at 05:43, Jeffrey Andrews wrote:
> I am stumped. I am trying to open another document from within a document. My AppController implements the delegate method
>
> -(BOOL) application:(NSApplication*) sender openFile:(NSString*)path
> {
> NSLog(@"AppController - application:openFile - %@", path);
> NSDocumentController* dc = [NSDocumentController sharedDocumentController];
> id doc = [dc openDocumentWithContentsOfURL:[NSURL URLWithString:path] display:YES];
> return (doc != nil);
> }
...
> How else should I handle opening another window with the file specified?
Yes, but you didn't say what happens. Does the delegate method get invoked? Is 'doc' nil? What happens if you use the non-deprecated 'openDocumentWithContentsOfURL:display:error:' instead? Is there an error returned? Shouldn't you be using 'fileURLWithPath:' instead of 'URLWithString'? Etc, etc.
_______________________________________________
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