• 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: NSOpenPanel and NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
References: 
 >NSOpenPanel and NSTableView (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Re: Subclassing NSTextField or...?
  • Next by Date: Re: Is there a ready chart plotting view?
  • Previous by thread: NSOpenPanel and NSTableView
  • Next by thread: Subclassing NSTextField or...?
  • Index(es):
    • Date
    • Thread