Show/Hide file extension issue in savePanel
Show/Hide file extension issue in savePanel
- Subject: Show/Hide file extension issue in savePanel
- From: Paul Figgiani <email@hidden>
- Date: Wed, 9 Sep 2009 17:40:07 -0400
Prior to installing Snow Leopard the following code worked with no problem,
It runs a savePanel for exporting an rtf doc with the contents of a
textVIew. Under 10.6 it still works. However the option to show/hide the
output file extension stopped working. The savePanel checkbox toggles the
visibility of the file extension in the output file name textField. However
the output file displays the extension regardless of the state of the
checkbox.
Note: The NSSavePanel Class References states that setRequiredFileType has
been depreciated in 10.6 and should be replaced with setAllowedFileTypes. I
tried this with no luck. In fact it breaks exporting.
How can I edit my code to fix the show/hide file extension issue?
thanks.
-paul.
-(IBAction)exportRTF:(id)sender
{
int index =[sender indexOfSelectedItem];
if (index==1){
NSSavePanel *panel = [NSSavePanel savePanel];
[panel setRequiredFileType:@"rtf"];
[panel setCanSelectHiddenExtension:YES];
[panel setTitle:NSLocalizedString(@"Export RTF Document", @"")];
[panel setNameFieldLabel:NSLocalizedString(@"Save As:", @"")];
if ([panel runModal] == NSOKButton) {
[[notes RTFFromRange:
NSMakeRange(0, [[mTextEditor string] length])]
writeToFile:[panel filename] atomically:YES];
}
}
_______________________________________________
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