• 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: Focus ring around NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Focus ring around NSTableView


  • Subject: Re: Focus ring around NSTableView
  • From: Nicholas Riley <email@hidden>
  • Date: Tue, 26 Mar 2002 03:29:16 -0600
  • Mail-followup-to: John Blackburn <email@hidden>, Steven Frank <email@hidden>, email@hidden

Yup, I was drawing way too much. Here's a much better version:

@interface NJRScrollView : NSScrollView {
BOOL shouldDrawFocusRing;
NSResponder *lastResp;
}

@implementation NJRScrollView

- (BOOL)needsDisplay;
{
NSResponder *resp = nil;
if ([[self window] isKeyWindow]) {
resp = [[self window] firstResponder];
if (resp == lastResp) return [super needsDisplay];
} else if (lastResp == nil) {
return [super needsDisplay];
}
shouldDrawFocusRing = (resp != nil && [resp isKindOfClass: [NSView class]] &&
[(NSView *)resp isDescendantOf: self]); // [sic]
lastResp = resp;
[self setKeyboardFocusRingNeedsDisplayInRect: [self bounds]];
return YES;
}

- (void)drawRect:(NSRect)rect {
[super drawRect: rect];
NSLog(@"%@ drawing focus ring? %hd", self, shouldDrawFocusRing);
if (shouldDrawFocusRing) {
NSSetFocusRingStyle(NSFocusRingOnly);
NSRectFill(rect);
}
}

Remove the NSLog when you're satisfied that it isn't drawing too much...

--
=Nicholas Riley <email@hidden> | <http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.

  • Follow-Ups:
    • Re: Focus ring around NSTableView
      • From: Steven Frank <email@hidden>
References: 
 >Re: Focus ring around NSTableView (From: Nicholas Riley <email@hidden>)
 >Re: Focus ring around NSTableView (From: John Blackburn <email@hidden>)

  • Prev by Date: [Off Topic] Package Maker and shell scripting
  • Next by Date: INFORMATION.....
  • Previous by thread: Re: Focus ring around NSTableView
  • Next by thread: Re: Focus ring around NSTableView
  • Index(es):
    • Date
    • Thread