• 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: color row table view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color row table view


  • Subject: Re: color row table view
  • From: "Tony S. Wu" <email@hidden>
  • Date: Wed, 5 Mar 2003 10:57:52 -0800

Never mind, I fixed it by combining my existing code with
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)theColumn row:(int)rowIndex

Thanks.

Tony S. Wu
email@hidden

"The world doesn't give us hope - it gives us chance."
http://homepage.mac.com/tonyswu/tonyswu - My web page.


On Wednesday, March 5, 2003, at 10:32 AM, Tony S. Wu wrote:

I did a search on the archives for color row table view, the search
comes up with some codes from Norbert:

- (void)drawRow: (int)rowIndex clipRect: (NSRect)clipRect
{
NSColor *bgColor;

if (![self isRowSelected: rowIndex])
{
if (delegateRespondsToTableViewBackgroundColorForRow)
{
bgColor = [[self delegate] tableView: self
backgroundColorForRow: rowIndex];

if (bgColor != nil)
{
NSLog(@"%@ %@ %@", NSStringFromRect([self rectOfRow:
rowIndex]), NSStringFromRect(clipRect),
NSStringFromRect(NSIntersectionRect([self rectOfRow: rowIndex],
clipRect)));
[[NSColor blackColor] set];
[[NSBezierPath bezierPathWithRect:
NSIntersectionRect([self rectOfRow: rowIndex], clipRect)] stroke];
[bgColor set];
NSRectFill(NSIntersectionRect([self rectOfRow:
rowIndex], clipRect));
NSRectFill([self rectOfRow: rowIndex]);
}
}
}

[super drawRow: rowIndex clipRect: clipRect];
}

- (void)setDelegate: (id)aDelegate
{
[super setDelegate: aDelegate];

delegateRespondsToTableViewBackgroundColorForRow =
[[self delegate] respondsToSelector:
@selector(tableView:backgroundColorForRow:)];
}

However, only the first 2 columns of my table view gets full background
color.
The others are only "stroked".
I then try to make all my table view's data cell has no background.
Now all columns get full background, but those rows that i don't want
background now gets stroked...
Can anyone tell me what i did wrong?

Tony S. Wu
email@hidden

"The world doesn't give us hope - it gives us chance."
http://homepage.mac.com/tonyswu/tonyswu - My web page.
_______________________________________________
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.
_______________________________________________
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.

References: 
 >color row table view (From: "Tony S. Wu" <email@hidden>)

  • Prev by Date: Getting information about volumes
  • Next by Date: Re: full-fledged file copying
  • Previous by thread: color row table view
  • Next by thread: Re: color row table view
  • Index(es):
    • Date
    • Thread