• 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: Change the text color in an NSTableView based on the data in the row
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Graham Cox <email@hidden>
  • Date: Mon, 7 Sep 2009 14:34:09 +1000


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


  • Follow-Ups:
    • Re: Change the text color in an NSTableView based on the data in the row
      • From: Bryan Zarnett <email@hidden>
References: 
 >Change the text color in an NSTableView based on the data in the row (From: Bryan Zarnett <email@hidden>)

  • Prev by Date: Is a serial NSOperationQueue FIFO?
  • Next by Date: Re: Turn on zombies in user environment?
  • Previous by thread: Change the text color in an NSTableView based on the data in the row
  • Next by thread: Re: Change the text color in an NSTableView based on the data in the row
  • Index(es):
    • Date
    • Thread