views:

1334

answers:

2

Hey all,

I'm wondering how to make a button or input field in Interface Builder react in such a way that on click it opens a file dialog and lets you select one or more files and puts them into a specified array/table...

Once the button is pushed and files are chosen (this seems a like quite trivial thing) I guess it will already contain some sort of array (like an array with paths to the selected files) so I've got that covered.. I only need to know how to link the button to a file selector and in what way the file selector delivers the files to me (or paths to the files) so I can redirect them to the array

Is there an easy way to do this, and more importantly; is there a file selector thingie or do I have to do this with XCode instead of Interface builder?

thanks...

ps. I'm sorry if this isn't the right site to ask these questions

+3  A: 

Interface Builder is for designing and linking together the interface. You want to open files and put them in an array, which is safely on the Xcode side of things. Have the button's action show an NSOpenPanel and give the results to your table's data source.

Chuck
+1  A: 

This must be done in Xcode. The code here should work fine.

Just hook the button up with a method using IB and use that example as a guide of what to put in the method.

There's also all sorts of good help WRT NSOpenPanel at Cocoadev, including tips on opening the panel as a sheet instead of a modal window.

Of course you should always read the Apple documentation as well.

Rich Catalano