Re: NSOutline view contents getting grayed
Re: NSOutline view contents getting grayed
- Subject: Re: NSOutline view contents getting grayed
- From: Graham Cox <email@hidden>
- Date: Sat, 6 Dec 2008 23:09:14 +1100
On 6 Dec 2008, at 10:34 pm, chaitanya pandit wrote:
That is happening because the outline view is loosing it's it's
first responder status.
You can refuse to resign the first responder status by overriding -
(BOOL)resignFirstResponder
and returning NO
Except that is likely to cause the rest of your user interface to stop
working in a useful way (i.e. text fields etc can't become key).
On 06-Dec-08, at 4:43 PM, Arun wrote:
Hi All,
I am writing a coca application in which i use NSOutline view for
Navigating
between different view like iTunes.
So when i am clicking on the ouline view contents, the contents are
highlighted in the blue.
If i click on any other view other than the ouline view, ouline
view content
which i had chosen is becoming light gray colour.
Is there any way in which i can still retain blue colour in the
selected
otline view content?
I handle this by subclassing the outline view and implementing:
- (void) highlightSelectionInClipRect:(NSRect) clipRect
{
[super highlightSelectionInClipRect:clipRect];
NSRange rows = [self rowsInRect:clipRect];
if( NSLocationInRange([self selectedRow], rows))
{
NSRect sr = [self rectOfRow:[self selectedRow]];
[[NSColor selectedTextBackgroundColor] set];
[NSBezierPath fillRect:sr];
}
}
Here I'm just using the selected text colour the user has set in the
system prefs, but you can use whatever you want.
Also, in 10.5 there were some new methods added that allow you to set
a highlighting style which might make this approach unnecessary, but
off the top of my head I don't know exactly the details as I'm not at
my main computer.
hth,
Graham
_______________________________________________
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