Skip navigation.
 
mlRe: What paradigm behind NSColor's drawing methods?
FROM : Ricky Sharp
DATE : Sat Feb 02 16:04:16 2008

On Feb 1, 2008, at 8:29 PM, Erik Buck wrote:

> I may have to change the way I have been drawing focus rings.  A 
> quick search and Apple's examples indicates that it is necessary to 
> save the graphics state before drawing a focus ring and restore it 
> after.  This must be particularly true if you draw the focus ring 
> outside the visible rect and/or clipping path of the focused view.


I believe it is indeed the case due to the focus ring being drawn 
outside the view's actual bounds.

I used to see bugs (in Tiger and earlier) when full keyboard access 
was turned on, a control had keyboard focus and then you used the 
mouse to track it.  If you clicked on the control and while keeping 
the mouse down, tracked on/off the control repeatedly, the focus ring 
would re-render itself over and over without first clearing the area. 
This led to an ever-darkening focus ring.

I do not see this in Leopard anymore, so perhaps the ability to now 
have overlapping views had something to do with the fix?


Anyhow, when I first worked on my custom UI, I had struggled with the 
focus ring being outside and ultimately "cheated" since I needed my 
own look.  I never use the provided focus ring APIs; instead, I just 
render a bezier path _inside_ the view's bounds.  And, since my UI 
controls are physically large, the extra few pixels around the actual 
control's body just added a bit of "slop" area to the hit region.

___________________________________________________________
Ricky A. Sharp        mailto:<email_removed>
Instant Interactive(tm)  http://www.instantinteractive.com

Related mailsAuthorDate
mlWhat paradigm behind NSColor's drawing methods? Jerry Krinock Feb 1, 20:41
mlRe: What paradigm behind NSColor's drawing methods? glenn andreas Feb 1, 21:47
mlRe: What paradigm behind NSColor's drawing methods? Jerry Krinock Feb 1, 22:18
mlRe: What paradigm behind NSColor's drawing methods? glenn andreas Feb 1, 22:44
mlRe: What paradigm behind NSColor's drawing methods? Erik Buck Feb 1, 23:49
mlRe: What paradigm behind NSColor's drawing methods? Peter Ammon Feb 2, 01:23
mlRe: What paradigm behind NSColor's drawing methods? Erik Buck Feb 2, 03:29
mlRe: What paradigm behind NSColor's drawing methods? Ricky Sharp Feb 2, 16:04
mlRe: What paradigm behind NSColor's drawing methods? Jerry Krinock Feb 4, 19:59