Re: Focus ring annoyance
Re: Focus ring annoyance
- Subject: Re: Focus ring annoyance
- From: "Sean McBride" <email@hidden>
- Date: Fri, 26 Aug 2005 12:41:40 -0400
- Organization: Rogue Research
On 2005-08-26 09:31, John Pannell said:
>I draw the ring with the technique found in example code...
>
>[NSGraphicsContext saveGraphicsState];
>NSSetFocusRingStyle(NSFocusRingOnly);
>NSRectFill(viewRect);
>[NSGraphicsContext restoreGraphicsState];
>[self setKeyboardFocusRingNeedsDisplayInRect:viewRect];
Where is this code? In drawRect:? Remember that in drawRect: you
should only do your drawing. If you want to mark something as needing
redrawing, say in response to a button click, you call set...NeedsDisplay...
So in drawRect: you should do this:
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
NSRectFill(viewRect);
[NSGraphicsContext restoreGraphicsState];
but not:
[self setKeyboardFocusRingNeedsDisplayInRect:viewRect];
That line should be called whenever you or the user does something that
requires redrawing the focus ring.
That's how I do it and it works in 10.3 and 10.4.
Also, I use:
[[NSBezierPath bezierPathWithRect:[self bounds]] fill];
not NSRectFill(), but I doubt that matters.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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