• 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
NSTextFieldCell text color issue in NSTableView with source list highlighting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextFieldCell text color issue in NSTableView with source list highlighting


  • Subject: NSTextFieldCell text color issue in NSTableView with source list highlighting
  • From: "email@hidden" <email@hidden>
  • Date: Thu, 12 Mar 2009 10:51:03 +0000

The recommended way to override the text color in an NSTableView NSTextFieldCell is detailed here:
http://www.cocoabuilder.com/archive/message/cocoa/2008/11/5/222008.


However, there seems to be a problem setting the text color of a highlighted NSTextFieldCell when NSTableView -selectionHighlightStyle is set to NSTableViewSelectionHighlightStyleSourceList.

The following delegate method produces uneven text coloration of highlighted text cells.

The issue does not arise for non source list style NSTableViews.

/*

 tableview will display cell

*/
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
// note that when the NSTableView Highlight mode is set to source list
// setting the text color of NSTextFieldCell seems to misbehave.
if ([aCell isKindOfClass:[NSTextFieldCell class]]) {
if ([aCell isHighlighted]) {
[aCell setTextColor: [NSColor lightGrayColor]];
} else {
[aCell setTextColor: [NSColor darkGrayColor]];
}
}
}


Has anyone else encountered this?

Work around solution is probably to use NSAttributedString.

Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextFieldCell text color issue in NSTableView with source list highlighting
      • From: Corbin Dunn <email@hidden>
    • Re: NSTextFieldCell text color issue in NSTableView with source list highlighting
      • From: Corbin Dunn <email@hidden>
    • Re: NSTextFieldCell text color issue in NSTableView with source list highlighting
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Detemine Document Types ...
  • Next by Date: Re: Detemine Document Types ...
  • Previous by thread: Re: Detemine Document Types ...
  • Next by thread: Re: NSTextFieldCell text color issue in NSTableView with source list highlighting
  • Index(es):
    • Date
    • Thread