Re: NSSavePanel and setting extensions... (SOLVED)
Re: NSSavePanel and setting extensions... (SOLVED)
- Subject: Re: NSSavePanel and setting extensions... (SOLVED)
- From: arekkusu <email@hidden>
- Date: Wed, 6 Aug 2003 11:04:06 -0700
Several months ago, this question was asked:
>
Im currently trying to make the extension in the standard save panel,
>
by default off. So when some person opens my app and clicks save, the
>
extension should be there by default.
>
>
Here is my current code:
>
>
- (BOOL)prepareSavePanel:(NSSavePanel*)savePanel
>
{
>
[savePanel setExtensionHidden:NO];
>
return YES;
>
}
and it was pointed out that while other settings such as the directory
do take effect in prepareSavePanel:,
setExtensionHidden: does NOT.
The same question was asked a few other time previously, with no good
answer given in the archives that I could find.
Well, here a way to force extensions to not be hidden by default, if
you are in a Document based app and don't want to bother creating your
own save panel:
in your app startup (or document init), check for the existence of the
user's extension saving pref, and if it doesn't exist, force it to be
no:
NSNumber *extn = [[NSUserDefaults standardUserDefaults]
objectForKey:@"AppleSavePanelHideExtension"];
if(extn == nil) {
[defaults setBool:NO forKey:@"AppleSavePanelHideExtension"];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.