• 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
Changing file types in NSOpenPanel while it's open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing file types in NSOpenPanel while it's open


  • Subject: Changing file types in NSOpenPanel while it's open
  • From: Chris Giordano <email@hidden>
  • Date: Thu, 6 Nov 2003 16:50:13 -0500

I'm wondering if it is possible to change the file types in an NSOpenPanel while the panel is open. So far, I've had some success but with some undesirable side effects, and my searches through the archives, the documentation, books and the web have produced a few questions but no results.

I've got a document-based application. What I'm attempting to do is to allow the user to import data from various file types into the document. I have a mechanism for identifying the parsers (that do the work of importing, loaded from bundles) each of which identifies the file types that it works with. I'm currently using an NSOpenPanel for the interface to my "Import" process, along with an accessory view that has a popup that contains the list of available parsers. What I want to have happen is that the files available for selection in the open panel are those that have the type allowed by the parser that is currently selected, and to have the allowed files change when the user selects a different parser from the popup.

To filter the file types in the open panel, I'm using NSSavePanel's delegate method panel:shouldShowFilename:. This seems to be working well, except that when I call NSSavePanel's validateVisibleColumns upon a change of parser in the popup, the directory selected in the panel's browser resets to something different. If the initial directory (set in beginSheetForDirectory:...) is /Users/myself/Documents, after validating the visible columns, the path in the panel's browser is /Documents !!

If I just don't call validateVisibleColumns, it almost works except that I have to change the selection and select a directory in order for its contents to be revalidated.

So, is it possible to do what I'm trying to do without starting from scratch? Is what I'm doing a gross bastardization of the HIG? Is it even a good idea? (Clearly I think so. Otherwise I wouldn't be doing it.) Or do I need to pursue something akin to the multi-step process that PB uses to create a new project (first select the type, then select location/name)?

For reference, I'm running 10.2.8.

Feel free to point me to documentation if it's stated somewhere and I've just not come across it yet.

thanks,
chris
_______________________________________________
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.

  • Prev by Date: Re: Modifying the array of an NSArrayController
  • Next by Date: contentSizeForFrameSize and frameSizeForContentSize for NSTabView and NSWindow?
  • Previous by thread: Finder Label Menu Item
  • Next by thread: contentSizeForFrameSize and frameSizeForContentSize for NSTabView and NSWindow?
  • Index(es):
    • Date
    • Thread