NSTableView context dependent row colors
NSTableView context dependent row colors
- Subject: NSTableView context dependent row colors
- From: Robert Mullen <email@hidden>
- Date: Tue, 28 Oct 2008 08:23:27 -0700
I am working on an application that uses NSTableViews for data
display. The individual rows need to have context dependent coloring.
I have this working reasonably well by using
NSTableView:tableView:willDisplayCell:forTableColumn:row: to inspect
the cells I need and then set the background color. I have some
concerns about this as it seems like a "chatty" way of doing things
although so far I have loaded several thousand rows and see no adverse
effects. I also have problems with cells that don't handle background
color well like checkbox cells. I can work around that but it is not
ideal. In addition to all this, I really want to use a gradient for
the row color as it fits the overall UI much better. I have seen
tutorials for doing the selected row this way and have copped them
into my code but not completely successfully. Right now if I use a
gradient image (not ideal but one step at a time as I am a Cocoa noob)
and do drawRect using rectOfRow:(int)row with
operation:NSCompositeSourceOver I get drawing anomalies. It works
somewhat once I scroll the NSTableView but the initial drawing
operation is over the top of the text. If I scroll the text appears
once it is scrolled back into view (seemingly a problem with using the
willDisplayCell delegate.)
All that as leadup, my question is whether I am barking up the wrong
tree with what I am doing. Is
NSTableView:tableView:willDisplayCell:forTableColumn:row: the correct
place to be doing this sort of thing? If not, where would one go about
setting the row color? Does anyone have good tutorials for dealing
with UI issues at this level? Most of the rest of the Objective-C/
Cocoa world seems relatively straightforward but the more intricate
control manipulations are still escaping me.
tx.
_______________________________________________
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