Re: Change the text color in an NSTableView based on the data in the row
Re: Change the text color in an NSTableView based on the data in the row
- Subject: Re: Change the text color in an NSTableView based on the data in the row
- From: Bryan Zarnett <email@hidden>
- Date: Mon, 7 Sep 2009 09:25:35 -0400
Thanks Graham,
I did the following and it worked fine:
NSNumber *isClosed = [[[activityController arrangedObjects]
objectAtIndex: row] valueForKey: @"isClosed"];
Cheers!
On 7-Sep-09, at 12:34 AM, Graham Cox wrote:
On 07/09/2009, at 9:40 AM, Bryan Zarnett wrote:
I would like to set the text color of the cell in an NSTableView
based on a particular set of data in the table of in the associated
array controller. I currently have the basic code for the coloring
changing working right now in "willDisplayCell". What I am not sure
about is how to (1) retrieve a column for the same row to check the
data for a cell, or (2) check the associate array controller being
used to populate the cell data to see if a different field has
related data.
For example, while viewing the "Name" column in "willDisplayCell",
I also want to see the other data that it is associated to --
perhaps not all the data is displayed in the NSTableView.
Thoughts?
Hi Bryan,
The row index usually represents the array index of the item in the
data model, and the column is a property for that item. Therefore
the rowIndex is all you need to retrieve *all* of the data for an
object, whether the table displays it or not. Both the column and
the row index are passed to the delegate method you mention.
You ask: "how to (1) retrieve a column for the same row" but that
doesn't make any sense - the column being drawn is passed to you,
and there isn't a "column for the same row". Columns and rows are,
quite literally, orthogonal.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden