Re: Copying formatted fields from an NSTableView
Re: Copying formatted fields from an NSTableView
- Subject: Re: Copying formatted fields from an NSTableView
- From: Brian Webster <email@hidden>
- Date: Mon, 13 May 2002 10:59:06 -0500
On Monday, May 13, 2002, at 10:21 AM, cocoa-dev-
email@hidden wrote:
I would like my app to be able to copy the selected rows of an
NSTableView into the pasteboard (as tab-separated text), so I could
paste the content of a table, say, in a text document. My problem is
that the table contains formatted fields (both dates and numbers) and I
would like to maintain the formatting information.
How can I do that?
Well, it depends on how you're setting the formatters for the
cells. Since NSTableView reuses cells, if you're using
different formatters for different rows, things can get tricky.
Basically, you'll have to create some way of figuring out what
formatter applies to each column/row, retrieve the object value
for the column/row (you could call your data source methods
directly, or factor that code out into a separate method), and
then call stringForObjectValue: on the formatter to get the
string.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.