• 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 annoyance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Focus ring annoyance
      • From: John Pannell <email@hidden>
References: 
 >Focus ring annoyance (From: John Pannell <email@hidden>)

  • Prev by Date: Creating multiple ABPerson instances from a single vcard file
  • Next by Date: Re: Finding transparent pixels in an image
  • Previous by thread: Focus ring annoyance
  • Next by thread: Re: Focus ring annoyance
  • Index(es):
    • Date
    • Thread