Hi Ivan, If you want all of the table views in your app to have the same special color scheme, the most reliable way to do this is by adding a category to NSColor and overriding the class method:
+ (NSArray *)controlAlternatingRowBackgroundColors; to return an array containing the two colors you want to use. If this special color requirement is for one table then it's a bit more difficult. I mean a lot more difficult. The first thing is to understand the order that the elements are being drawn in. This is what I think is happening: 1. the table view draws its background color 2. the table view draws its selections on top of that 3. the table view draws the cells for its rows on top of that So you check if the cell is highlighted with the NSCell method: - (BOOL)isHighlighted and as Jens said, don't draw the background color in the cell for that case. Then you'll see the color that the table view has drawn for you. The whole problem with this method is that the table view only draws as many rows as it needs to display. If your table view is always full, I guess that's fine. What about when you only need to display 3 rows but your table view is large enough to display 10? You will only see your alternating colors for those 3 rows. If you want to truly mimic NSTableViews alternating rows drawing, I think you will need to subclass the table view's drawRect: method and do the drawing yourself using the row height. I would use the NSColor category if you can with the requirements of the project. Best of luck, Cathy On Tue, Mar 25, 2008 at 5:28 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: > > On 25 Mar '08, at 12:34 AM, Ivan C Myrvold wrote: > > > This works fine for the columns which have NSTextFieldCell, and it > > also colors the column with the NSButtonCell, > > but when I select a row, the column with NSButtonCell still have the > > color as set above, and not the selection color. > > You could check whether the row is selected, and if so, not change the > cell's background color... > > —Jens > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/catshive%40gmail.com > > This email sent to [EMAIL PROTECTED] > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]