Re: NSOpenPanel and NSTableView
Re: NSOpenPanel and NSTableView
- Subject: Re: NSOpenPanel and NSTableView
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 10 Apr 2003 01:50:00 -0700
On Thursday, April 10, 2003, at 12:34 AM, Peter Karlsson wrote:
I need a code example that shows me how to open a .syx (system
exclusive) file and load the names (40) of that file into a
NSTableView. The NSOpenPanel code is already done but what do I need
to do after I have selected a file and pressed the OK button? Can
someone point me in the right direction please?
If you've got a table view with a single column:
After the panel is over, and the user clicked on OK, then call
[openPanel filenames] to get the file names returned and store that in
an array within your class (which I'll call "files" below). After doing
this, call your table view's -reloadData method. Then, for the
NSTableView data source code...
- (int)numberOfRowsInTableView
{
return [files count];
}
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
return [files objectAtIndex:rowIndex];
}
That's all there is to it!
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://dreamless.home.attbi.com/
"Building the future and keeping the past alive are one and the same
thing." - Metal Gear Solid 2
_______________________________________________
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.