Re: NSSavePanel runModalForDirectory, set name selection?
Re: NSSavePanel runModalForDirectory, set name selection?
- Subject: Re: NSSavePanel runModalForDirectory, set name selection?
- From: Henrietta Read <email@hidden>
- Date: Thu, 30 Apr 2009 19:26:04 -0700
Perhaps I'm not understanding properly, but are you suggesting that I use
NSOpenPanel to save files?
That doesn't make any sense...
On Thu, Apr 30, 2009 at 3:14 PM, Tom Hohensee <email@hidden> wrote:
> HenriettaYou have to use NSFileManager displaynameAtPath: in conjuction
> with NSOpenPanel. Here is some sample code I hope helps
>
> //Run the open panel
> [panel beginSheetForDirectory:nil file:nil types:fileTypesArray
> modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(
> openPanelDidEnd:returnCode:contextInfo:)contextInfo:NULL];
>
> -(void)openPanelDidEnd:(NSOpenPanel*)sheet
> returnCode:(int)returnCode
> contextInfo:(void*)contextInfo {
> //Did they choose open
> if (returnCode == NSOKButton)
> {
> NSFileManager *fileManager = [NSFileManager defaultManager];
> NSString *displayNameAtPath = [fileManager displayNameAtPath:[sheet
> filename]];
> .........
> ....
> ..
> .
> }
> }
>
> Tom
>
>
> On Apr 30, 2009, at 3:28 PM, Henrietta Read wrote:
>
> Question,
>
> I'm passing a file name such as 'MyTextFile.txt' to NSSavePanel
> runModalForDirectory.
>
> When the panel appears the entire string is selected, but I would rather
> that just
> 'MyTextFile' is selected. Is it possible to set the selection to exclude
> the
> file
> extension?
>
>
> Thank you.
> _______________________________________________
>
> 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