• 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: "Open dialogue"-like file system browser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Open dialogue"-like file system browser


  • Subject: Re: "Open dialogue"-like file system browser
  • From: David Zentgraf <email@hidden>
  • Date: Tue, 17 Jan 2006 17:57:55 +0100

Thanks a bunch Uli, that's a lot of information. Will work my way through it.

Chrs,
Dav

On 2006/01/17, at 16:10, M. Uli Kusterer wrote:

David,

you'll have to do this yourself, as in general that's not what you'd do in a shipping application. If you want to do it as an exercise, then by all means write *all* of the code yourself, otherwise it wouldn't give you much practice.

If you want something that works just like an open dialog, use an NSOpenPanel, because that's what it's there for. You can add an accessory view to it to add a few other controls, and that's usually enough flexibility.

You may also want to check out the drag and drop code, which is usually used when you need to have the user specify a file (with the addition that, since Users can use Spotlight or Finder or PathFinder or whatever they prefer, you get a better user experience than by *requiring* use of an open panel).

Between all those, it's usually not necessary to roll your own open panel. If you do, you're either doing something so innovative that you will be glad you wrote your own because that way you can customise it out the wazoo, or you're reinventing the weel (which is the best kind of exercise for beginners, of course).

Oh, one more note: Sidebar is rather hackish: There are APIs to list files (see NSWorkspace), but none to get the sidebar contents. The best way I found was to parse the com.apple.sidebar.plist file in ~/Library/Preferences/ (filename may not be exact, but it's an obvious name). That file is a property list, so dictionaryFromContentsOfFile: will do most of the work. The garbage data in there is an alias record, use NDAlias or BDAlias (thrid- party code you can google for) to turn that NSData into the most current and reliable file path.

Cheers,
M. Uli Kusterer
------------------------------------------------------------
       "The Witnesses of TeachText are everywhere..."
                   http://www.zathras.de

_______________________________________________ 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: 
 >"Open dialogue"-like file system browser (From: David Zentgraf <email@hidden>)

  • Prev by Date: Re: Q: "Linking" to mail messages?
  • Next by Date: Re: [Core Data] Improve save performance ?
  • Previous by thread: Re: "Open dialogue"-like file system browser
  • Next by thread: Re: "Open dialogue"-like file system browser
  • Index(es):
    • Date
    • Thread