Skip navigation.
 
mlNSButtonCell in NSTableView doesn't receive setHighlighted:
FROM : Sebastian Morsch
DATE : Sat Jan 05 15:24:33 2008

Hi,

I just found out that an NSButtonCell that sits in an NSTableView 
doesn't receive the setHighlighted: message from the table when it's 
displayed for a selected row. In the case of NSImageCell and 
NSTextFieldCell it DOES happen, they both receive that message from 
the table's preparedCellAtColumn:row: method.

I couldn't find an answer to this in previous posts.

I worked around this by subclassing NSTableView and overriding that 
method to make sure all cells get the setHighlighted:

- (NSCell *)preparedCellAtColumn:(NSInteger)column row:(NSInteger)row
{
   NSCell* cell = [super preparedCellAtColumn:column row:row];
   
   [cell setHighlighted:(row == [self selectedRow])];
   
   return cell;
}


It's not a big deal of course, but since setHighlight: is a superclass 
method from NSCell it seems strange to me that the table doesn't treat 
all cells equally. Is this expected behaviour or is it worth filing a 
bug?


Sebastian

Related mailsAuthorDate
mlNSButtonCell in NSTableView doesn't receive setHighlighted: Sebastian Morsch Jan 5, 15:24
mlRe: NSButtonCell in NSTableView doesn't receive setHighlighted: Ken Ferry Jan 5, 19:29
mlRe: NSButtonCell in NSTableView doesn't receive setHighlighted: Sebastian Morsch Jan 6, 10:31