• 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
Re: selected table row color ala itunes ? [2]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: selected table row color ala itunes ? [2]


  • Subject: Re: selected table row color ala itunes ? [2]
  • From: Fabian Lidman <email@hidden>
  • Date: Tue, 16 Dec 2003 19:19:18 +0100

In iTunes, when an album is selected, the cell is drawn with a blue
shaded.
I want to do the same thing, not to draw alternate backgound color for
the table view background.

Obviously, you need to check whether the row is selected before you draw your green rectangle (or shaded image). In your case, the code might look like this (untested, but you'll get the idea):

-(void) drawRow: (int)rowIndex clipRect: (NSRect)clipRect {
NSString* string = [[self dataSource] tableView: self objectValueForTableColumn: nil row: rowIndex];
NSRect* rect = [self rectOfRow: rowIndex];
NSPoint textPoint = NSMakePoint( rect.origin.x + 4 , rect.origin.y + 2 );
NSDictionary* attrs = [NSDictionary dictionaryWithObject: [NSFont systemFontOfSize: 10.0] forKey: NSFontAttributeName];

if( [self isRowSelected: rowIndex] ) {
[[NSColor greenColor] set];
[NSBezierPath fillRect: rect];
[[NSColor whiteColor] set];
}
else {
[[NSColor whiteColor] set];
[NSBezierPath fillRect: rect];
[[NSColor blackColor] set];
}

[string drawAtPoint: textPoint withAttributes: attrs];
}
_______________________________________________
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.

References: 
 >selected table row color ala itunes ? (From: Thierry Bucco <email@hidden>)
 >selected table row color ala itunes ? [2] (From: Thierry Bucco <email@hidden>)

  • Prev by Date: NSFont system help or documentation needed
  • Next by Date: sending mail
  • Previous by thread: Re: selected table row color ala itunes ? [2]
  • Next by thread: Re: selected table row color ala itunes ?
  • Index(es):
    • Date
    • Thread