• 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
NSOutlineView Row Selection Color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOutlineView Row Selection Color


  • Subject: NSOutlineView Row Selection Color
  • From: haym37 <email@hidden>
  • Date: Sun, 5 Feb 2006 00:24:48 -0500

After reading much about how to customize the color of the selected row in an NSOutlineView, I am still unable to get it to work. Here's what I have:

- LeftMenuController.h which is a subclass of NSOutlineView
- LeftMenuController.m which contains the following code:

- (id)_highlightColorForCell:(NSCell *)cell
{
	NSLog(@"here");
	return nil;
}

- (void)highlightSelectionInClipRect:(NSRect)clipRect
{
NSLog(@"here");
if (selectedRow != -1)
{
[outlineView lockFocus];

NSImage *gradientHighlight;
if(([[outlineView window] firstResponder] == outlineView) && [[outlineView window] isMainWindow] && [[outlineView window] isKeyWindow])
{
gradientHighlight = [NSImage imageNamed:@"LeftMenuRowHighlightFocused.png"];
}
else
{
gradientHighlight = [NSImage imageNamed:@"LeftMenuRowHighlightUnFocus.png"];
}

[gradientHighlight setFlipped:NO];
[gradientHighlight setScalesWhenResized:YES];

NSRect drawingRect = [outlineView rectOfRow:selectedRow];

NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [gradientHighlight size];

if(drawingRect.size.width != 0 && drawingRect.size.height != 0)
{
[gradientHighlight drawInRect:drawingRect fromRect:imageRect operation:NSCompositeSourceOver fraction:1.0];
}

[outlineView unlockFocus];

}
}


In Interface Builder, I have LeftMenuController as the dataSource and delegate of the NSOutlineView.

Still, when selecting a row in the NSOutlineView, rather than displaying the background as the LeftMenuRowHighlightFocused.png gradient, it still displays it as the standard dark blue.

Is there another thing that I should be doing to have it work?  Thanks!
_______________________________________________
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


  • Follow-Ups:
    • Re: NSOutlineView Row Selection Color
      • From: Guillaume Gandreau <email@hidden>
  • Prev by Date: Re: ScreenSaverEngine loading wrong view!
  • Next by Date: When is a program that is running not really running?
  • Previous by thread: Re: Trying to draw numbers into a dock icon badge
  • Next by thread: Re: NSOutlineView Row Selection Color
  • Index(es):
    • Date
    • Thread