• 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
How do I get a file panel like NSDocument for my Export and Import items?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I get a file panel like NSDocument for my Export and Import items?


  • Subject: How do I get a file panel like NSDocument for my Export and Import items?
  • From: Scott Ellsworth <email@hidden>
  • Date: Mon, 28 Mar 2005 15:15:09 -0800

Hi, all.

I have an app that can import and export to either ".sec" or ".sectab" files. Since the native Core Data files are richer, I implemented separate Import and Export menu items.

I am using NSOpenPanel for import and NSSavePanel for export. These are working, but I do not get the pulldown that selects whether they want to write a .sec or a .sectab file. Is there a way to get this pulldown and type enforcement on a standard Open or Save panel?

My app currently has code like:

NSArray *fileTypes = [NSArray arrayWithObjects: @"sec", @"sectab", nil];
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel setCanChooseFiles:YES];
[panel setCanChooseDirectories:NO];
int result = [panel runModalForTypes:fileTypes];
if (result == NSOKButton) {
NSArray *urlsToOpen = [panel URLs];
// import urls
}


and

NSSavePanel * sp = [NSSavePanel savePanel];
[sp setAllowedFileTypes:[NSArray arrayWithObjects:@"sec",@"sectab",nil]];
int runResult = [sp runModal];
if (runResult == NSOKButton) {
NSURL * url = [sp URL];
// write file
}


which seems to be working for file selection, but it does not enforce the extension via a pulldown
Scott
_______________________________________________
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
  • Prev by Date: Re: Need longer highlight w/ NSButton performClick:
  • Next by Date: How to you provide Application "helper" extensions?
  • Previous by thread: Help with a NSScrollView
  • Next by thread: How to you provide Application "helper" extensions?
  • Index(es):
    • Date
    • Thread