Drawing only when NSOutlineView active?
Drawing only when NSOutlineView active?
- Subject: Drawing only when NSOutlineView active?
- From: Nicholas Riley <email@hidden>
- Date: Sun, 2 Mar 2008 07:39:38 -0600
I'm attempting to draw a custom NSOutlineView row background only for
selected rows of an active outline view; otherwise, the default
drawing style is fine. I started with the following:
- (void)highlightSelectionInClipRect:(NSRect)clipRect;
{
// the outline view is in a sheet, so the main window is always
the window to which it's attached
if ([[self window] firstResponder] != self || ![[self window]
isKeyWindow]) {
[super highlightSelectionInClipRect: clipRect];
return;
}
// fancy drawing here
This works fine except in two cases, when the test is inadequate and
NSOutlineView draws an ordinary active row.
1. When another window, such as the Character Palette, or a status
item gets keyboard focus. To work around this, I can change the
second check to:
[NSApp keyWindow] != [self window]
which surprisingly returns a different result than ![[self window]
isKeyWindow].
2. When a menu-window (e.g., the help menu's NSCarbonMenuWindow)
becomes key. In this case, the key window changes by either measure.
Is there a more effective way to discover whether I should draw the
row background as active or not?
--
Nicholas Riley <email@hidden> | <http://www.uiuc.edu/ph/www/njriley>
_______________________________________________
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