• 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: John Pannell <email@hidden>
  • Date: Fri, 26 Aug 2005 13:44:48 -0600

Hi Sean-

That was a good call (it was in drawRect:) and I moved the relevant code, but still no focus ring. Anyone else lost focus in Tiger?

John

On Aug 26, 2005, at 10:41 AM, Sean McBride wrote:

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
References: 
 >Focus ring annoyance (From: John Pannell <email@hidden>)
 >Re: Focus ring annoyance (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Problems while using NSBezierPath
  • Next by Date: Re: NSTokenField
  • Previous by thread: Re: Focus ring annoyance
  • Next by thread: How to know and open Password protected pdf (like preview)
  • Index(es):
    • Date
    • Thread