• 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: Steven Frank <email@hidden>
  • Date: Mon, 25 Mar 2002 18:16:44 -0800

On Monday, March 25, 2002, at 02:16 PM, Nicholas Riley wrote:

On Mon, Mar 25, 2002 at 01:43:44PM -0800, Steven Frank wrote:
I'd like a standard system focus ring to appear around the "active" one,
as the user switches between them. What's the best way to achieve this?

Subclass (or pose as) NSScrollView and add:

- (void)drawRect:(NSRect)rect {
[super drawRect: rect];
if ([[self window] isKeyWindow]) {
NSResponder *resp = [[self window] firstResponder];
if ([resp isKindOfClass: [NSView class]] && [(NSView *)resp isDescendantOf: self]) { // [sic]
NSSetFocusRingStyle(NSFocusRingOnly);
NSRectFill(rect);
}
}
[self setKeyboardFocusRingNeedsDisplayInRect:rect];
}

That's not super-efficient but I've used it in several applications
and it seems to perform OK.

Thank you! This works, but it does seem to incur a bit of a penalty.

It gets called every time the tableview is scrolled, selection changes, etc, and as a result, the app is noticeably slower when scrolling through the table than without it.

Any suggestions on how this could be improved?

Steven
_______________________________________________
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.

References: 
 >Re: Focus ring around NSTableView (From: Nicholas Riley <email@hidden>)

  • Prev by Date: Re: NSControl with NSCells (Really: EOF request)
  • Next by Date: Re: Project Builder 1.1.1 won't start
  • Previous by thread: Re: Focus ring around NSTableView
  • Next by thread: Re: Focus ring around NSTableView
  • Index(es):
    • Date
    • Thread