Lefora Free Forum
login join
Loading
1858 views

Cocoa file browser panel

Page 1
1–4
rookie - member
2 posts

hi guys,

cocoa newbie here. i am developing a small app which requires the users to browse to a directory. that standard os x browse/open panel will work great for me.

i was wondering if i need to lay the panel from start or is there a ready made default available in cocoa?

it would be incredibly helpful if somebody can point me in the right direction.

Best,
Zippo

?
288 posts

Oh, there's a standard class NSOpenPanel for doing that.  The class NSOpenPanel does this for you.  I highly recommend that you get Aaron Hillegass book.  He has code on page 255 for doing this.

If you don't have the book, you can download Aaron's solution code and build and execute the code:
Solutions/15_MouseEvents/ImageFun_D/ImageFun.xcodeproj/ (in AppController.m)
 http://www.bignerdranch.com/solutions/Cocoa-3rd.tgz

When you look at the help information in XCode for NSOpenPanel, you'll see references to other sample applications provided by Apple in which this is being used.

I have a couple of observations however about this.  You'll notice that Aaron is at page 255 before he introduces this subject - so there's quite a lot to learn before you understand how to work with this.  I therefore encourage you to get and read the book (and work with the code).  Most folks agree that while Obj/C is a very useful framework, you'll find it difficult to understand without a book to guide you.  Aaron's book is the guide that everybody recommends.

__________________
rookie - member
2 posts

hey clanmills,

thanks a lot. that was extremely detailed information.
I did order the book, it arrived yesterday, but i am a long way from page 255 :-)

thanks again.

Best,
Zippo

?
288 posts

By coincidence, somebody pasted the code on this message:

http://www.cocoaforum.com/2010/03/11/code-for-saving-a-document/#post3

There seems to have been an outbreak of "I don't like the book" messages on the forum.  I'll be interested to hear your thoughts about it as you open it up and use it.

__________________
Page 1
1–4

Locked Topic


You must be a member to post in this forum

Join Now!