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

Re: NSOutlineView Row Selection Color


  • Subject: Re: NSOutlineView Row Selection Color
  • From: Keith Wilson <email@hidden>
  • Date: Sun, 5 Feb 2006 22:22:18 +1100

The following works if you simply want to override the default (blue) highlight for the selected row with grey

-(id)_highlightColorForCell:(NSCell *)cell
{
  return [NSColor colorWithCalibratedWhite:0.9f alpha:1.0f];
}
Keith


On 05/02/2006, at 7:59 PM, Guillaume Gandreau wrote:

Hi,
You have to teel IB that your outlineview is of type LeftMenuController.h.
In Information panel, go to Custom class and choose your classe.
If your class doesn't appear, drag the header from XCode to IB.
Hope this help !
LeChatNoir


On 5 févr. 06, at 06:24, haym37 wrote:

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:
@free.fr


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40bigpond.net.au


This email sent to email@hidden

_______________________________________________ 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: haym37 <email@hidden>
References: 
 >NSOutlineView Row Selection Color (From: haym37 <email@hidden>)
 >Re: NSOutlineView Row Selection Color (From: Guillaume Gandreau <email@hidden>)

  • Prev by Date: Re: When is a program that is running not really running?
  • Next by Date: Re: creating a preference window safari style
  • Previous by thread: Re: NSOutlineView Row Selection Color
  • Next by thread: Re: NSOutlineView Row Selection Color
  • Index(es):
    • Date
    • Thread