Re: how do you change the highlight color for rows in an NSOutlineView?
Re: how do you change the highlight color for rows in an NSOutlineView?
- Subject: Re: how do you change the highlight color for rows in an NSOutlineView?
- From: Andy Lee <email@hidden>
- Date: Fri, 3 Jun 2005 06:12:48 -0400
On Jun 1, 2005, at 3:01 PM, Mike Morton wrote:
I can override NSCell's highlightColorWithFrame:inView: to return
the correct color, but:
(1) The cell doesn’t draw in the outline’s intercell spacing, so we
get gaps unless we set the spacing to zero. Is there a better
solution?
Maybe override -frameOfCellAtColumn:row: (from NSTableView) to be one
pixel bigger?
(2) More importantly, the cell used to draw the outline doesn't get
my override. Debugging, it looks like an NSButtonCell, so I tried
override-and-pose-as on NSButtonCell to make the highlight happen
there -- nothing changes. Are there really two cells for the one
outline column? If so, can I substitute my own class for the cell
which draws the outline?
Odd, my quick-and-dirty debug session shows it to be an NSTextFieldCell:
(gdb) p (NSTableColumn *)[[myOutline tableColumns] objectAtIndex:0]
$1 = (class NSTableColumn *) 0x386ea0
Current language: auto; currently objective-c
(gdb) po [$1 dataCell]
<NSTextFieldCell: 0x37d040>
(gdb) p (NSTableColumn *)[[myOutline tableColumns] objectAtIndex:1]
$2 = (class NSTableColumn *) 0x376ad0
(gdb) po [$2 dataCell]
<NSTextFieldCell: 0x382bd0>
(gdb)
...so maybe you'd have better luck overriding that? Also, you could
try -[NSTableColumn setDataCell:] instead of posing.
(...a few minutes later...) Okay, I just did a quick test using -
setDataCell: with a subclass of NSTextFieldCell. The *text* portion
of the cell picks up my overridden highlight color, but the *image*
portion (the part with the triangle) doesn't. To get it just right,
you might have to hack further to use an image that has transparency
surrounding the triangle. But I'm not positive about the conclusions
I'm jumping to, because my test was very quick and dirty.
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden