Re: color row table view
Re: color row table view
- Subject: Re: color row table view
- From: Lucas Haley <email@hidden>
- Date: Wed, 5 Mar 2003 12:34:24 -0800
Its a bug in IB, where only the 2 automatically generated columns are
correct. Another way around this is to copy-paste those columns in IB,
as opposed to entering a number for "Number of Columns".
-lucas
On Wednesday, March 5, 2003, at 11:17 AM, Yojimbo wrote:
If I understand you correctly this is because you added the columns in
IB and those cells automatically have drawsBackground enabled.
You can reconfigure this for each column in either your controller's
awakeFromNib or in the -tableView:willDisplayCell:forTableColumn:row
delegate method.
You will need to get the cell object and use something like:
if([aCell respondsToSelector:@selector(setDrawsBackground:)]) {
[aCell setDrawsBackground:NO];
}
Hope that helps,
Jim
On Wednesday, Mar 5, 2003, at 10:32 US/Pacific, 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.
----
Dad always thought laughter was the best medicine, which I guess is why
several of us died of tuberculosis.
_______________________________________________
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.