Highlighting Cell Problem
Highlighting Cell Problem
- Subject: Highlighting Cell Problem
- From: Oliver Cameron <email@hidden>
- Date: Sat, 29 Jan 2005 23:29:20 +0000
Hi guys,
I have a custom NSTextFieldCell, and basically all it does is move the
y origin down a pixel, by doing this:
- (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)view
{
frame.origin.y += 1;
[super drawInteriorWithFrame:frame inView:view];
}
I have 2 NSTableColumn's that use this cell, but ideally I would like
to apply some different attributes to the cell, but I don't want to
hardcode them into the NSTextFieldCell subclass (its supposed to be
reused a lot). So I did this:
- (void)tableView:(NSTableView *)table willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
if ([[tableColumn identifier] isEqualToString:@"Option"])
{
if (cell == [tableColumn dataCell])
{
NSTextFieldCell *titleCell = [tableColumn dataCell];
[cell setFont:[NSFont systemFontOfSize:11]];
}
}
if ([[tableColumn identifier] isEqualToString:@"Description"])
{
if (cell == [tableColumn dataCell])
{
NSTextFieldCell *descriptionCell = [tableColumn dataCell];
[cell setFont:[NSFont systemFontOfSize:11]];
if ([cell isHighlighted])
[cell setTextColor:[NSColor whiteColor]];
else
[cell setTextColor:[NSColor grayColor]];
}
}
}
And this is what it looks like:
http://www.talacia.com/1.jpg
So you can see it works to some degree, but when I select an item (or
in this case, all the items) you will notice some weird artefacts above
the separation lines.
http://www.talacia.com/2.jpg
And of-course, the isHighlighted code doesn't seem to work either (in
some ways).
The weird thing is, if I just set my cell to completely default (get
rid of the NSTextFieldCell subclass too), I don't get the weird
artefacts, but the isHighlighted code doesn't work aswell.
Any ideas appreciated,
Thanks,
Oliver
_______________________________________________
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