Re: Setting initial filename for Save As
Re: Setting initial filename for Save As
- Subject: Re: Setting initial filename for Save As
- From: Simon Strandgaard <email@hidden>
- Date: Mon, 12 Dec 2005 23:56:54 +0100
On 12/12/05, Derrick Bass <email@hidden> wrote:
>
I would like set an initial filename in my Save As dialog that is
>
different from the default. (It does some pretty destructive editing.
How about something ala this?
-(void)saveas:(id)sender {
NSSavePanel* panel = [NSSavePanel savePanel];
[panel
beginSheetForDirectory:nil
file:_save_filename
modalForWindow:[NSApp mainWindow]
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:)
contextInfo:nil
];
}
-(void)savePanelDidEnd:(NSOpenPanel*)panel
returnCode:(int)rc contextInfo:(void*)ctx {
if(rc != NSOKButton) {
return;
}
_has_save_filename = true;
_save_filename = [[panel filename] retain];
[_document save:_save_filename];
}
--
Simon Strandgaard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden