• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSavePanel: Hide extension is killing the extension
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSavePanel: Hide extension is killing the extension


  • Subject: Re: NSSavePanel: Hide extension is killing the extension
  • From: Eric Brunstad <email@hidden>
  • Date: Sat, 11 Jun 2005 20:58:57 -0400


On Jun 11, 2005, at 6:29 PM, Theodore H. Smith wrote:

From: Eric Brunstad


What you are doing is wrong.

Do this instead:

[sp setAllowedFileTypes:[NSArray arrayWithObjects:@"htm",@"html"]];
[sp setCanSelectHiddenExtension:YES];
runResult = [sp runModalForDirectory:nil file:@"untitled.htm"];


The reason why you must do this is becuase Cocoa must know what extension to slap on the name when the checkbox is selected.


Hi Eric,

What I am trying to do, is provide a default file extension, but allow them to change the extension as they like. For HTML, this isn't so bad, because there are a variety of html extensions (.html, .htm, .shtml, etc). Sometimes HTML comes with no file extension, even.

For example "MyHTMLFileName" and "MyHTMLFileName.html" are both perfectly valid HTML file names.

Should I just forget the whole filetypes thing in such a case, and just specify a filetype of nil, and also not even allow them to hide the extension?

Hi Theodore,

Try this:

[sp setAllowsOtherFileTypes:YES];

This will allow the user to change the extension.

P.S. I would suggest that you download AppKiDo from http://homepage.mac.com/aglee/downloads as it organizes all of the Cocoa classes and methods so you can easily find what you are looking for.  Then, you will be able to easily find methods such as -setAllowsOtherFileTypes.

-Eric
 _______________________________________________
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

References: 
 >Re: NSSavePanel: Hide extension is killing the extension (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: IBOutlet & NSTabView
  • Next by Date: Re: NSMutableDictionary setObject:forKey:
  • Previous by thread: Re: NSSavePanel: Hide extension is killing the extension
  • Next by thread: Archiving selection index paths with core data
  • Index(es):
    • Date
    • Thread