Hi guys !

I'm trying to implement a "welcome screen" like the ones found in Garage Band 
or Xcode : the user will be showed a window with a "Create new document" button 
that, when clicked, show a save panel. Once saved, the application should open 
the document.

I'm facing a problem when I try to save the newly created document on the disk 
: the application raise an error ('The document 'MyDoc' could not be saved").

Here is the code I use to show the save panel and save the document to the disk 
:

- (IBAction)createNewDocument:(id)sender {
        NSSavePanel * savePanel = [NSSavePanel savePanel];
        
        [savePanel beginSheetForDirectory:nil
                file:NSLocalizedString(@"MyDoc", @"")
                modalForWindow:[self window]
                modalDelegate:self
                
didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
                contextInfo:nil];
}

- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode 
contextInfo:(void *)contextInfo {
        if (returnCode == NSOKButton) {
                NSPersistentDocument * newDoc = [[[NSPersistentDocument alloc] 
init] autorelease];
                
                [newDoc setFileType:@"SQLite"];
                [newDoc setFileURL:[sheet URL]];
                [newDoc saveDocument:self];
        }
        
        [sheet orderOut:self];
}

Can someone help me on this ?


Thanks by advance,

Eric.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to