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: Jeffrey Andrews <email@hidden>
- Date: Mon, 11 Jan 2010 15:22:03 -0500
The document doesn't pop up a new window. The delegate does get
called, but doc is nil. But, if I use [[NSWorkspace sharedWorkspace]
openFile:path withApplication:@"MyAppName"], it works.
I just thought that I shouldn't have to rely on NSWorkspace.
I will try your suggestion of using the newer method. I thought that
the fileURLWithPath includes "file://" that I don't want. Other
examples show URLWithString, too.
Thanks, Quincey.
On Jan 11, 2010, at 12:41 PM, Quincey Morris wrote:
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
_______________________________________________
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