22
Oct

NSFileBrowser

I’ve been working for the last couple of days on a project for my band Drongo Sealion Magic. We use a lot of samples in our music, all of which we store as MP3s on a laptop, and we wanted a simple playing mechanism which was more responsive than something like QT or iTunes. Unfortunately, we didn’t have much luck finding one, so I thought I would write one. More on that later.

One of the things I want to have is a file browser so you can quickly change the samples you’ve got loaded. For some reason though, Cocoa doesn’t appear to have a standard File Browser object. This is something I think is a bit odd. I can understand the reasoning, obviously most applications will make do with the Open/Save dialogues, and those that don’t probably need some form of custom browser anyway. But surely, for consistencie’s sake, they would want developers to present a standard browser so that people would be using the same browser across all their apps? As it stands, I’m having a hard time replicating the look and feel of the standard list browser in Finder. Perhaps someone should write an “NSFileBrowser” style class. Perhaps it should be me…

Comments ( 2 )
  • Dave says:

    I imagine that part of the problem is that Finder is actually written in Carbon, not Cocoa. That should change with the latest Snow Leopard release, they’re rewriting it to use Cocoa instead. I agree that NSFileBrowser would be pretty cool though. Any chance of subclassing that to get the kind of behaviour you want?

  • Griff says:

    In the end I followed an example in the Developer folders which provides a *very* basic file browsing structure. It needs a lot of work to make it pretty, but it suffices for now.

    I’ve realised that the reason they don’t offer it is because an NSFileBrowser class wouldn’t fit in with the MVC model – it would have to be bother the view and the controller, so it would actually need at least two or three classes to actually work. Would still be useful though.

Leave A Comment

Your email address will not be published. Required fields are marked *