Thank you all for your responses. I need to support 10.6.8, so in end I chose 
two different approaches for the textview and pdfview.

For the textview, I handle drawing a thin rect around the textview's bounds 
when it is first responder. I just handle the change in 
-becomeFirstResponder and -resignFirstResponder.

For the pdfview, I embedded it in an NSView which receives notifications when 
the pdfview becomes or resigns first responder. Then it draws a thin rect 
around its bounds. The pdfview is then 1 pixel smaller on all sides that this 
container view.

I'm not really happy with either of these solutions, but nothing else seemed to 
work so far. The end result is visually not too bad. The thing I like least is 
that I need this 1 pixel gap in the container view for the pdfview. Because 
when the pdfview doesn't have focus, I have to decide to draw something there. 
For now I toggle between stroke colors (dark grey and focus ring color).

Cheers,

Martin


On 2, Feb, 2012, at 05:34 PM, Sean McBride wrote:

> On Thu, 2 Feb 2012 09:05:14 +1100, Graham Cox said:
> 
>> Some views don't actually implement a focus ring, leaving it to you.
>> This is often the case if the view is typically used for content within
>> a scrollview. Bear in mind also that the focus ring is drawn outside the
>> frame of the view, so there has to be a) space available to draw it, and
>> b) code there to do that drawing outside the view. These are things you
>> might want to check. If necessary, you may have to subclass the view and
>> add the focus ring yourself.
> 
> In 10.7, there is new API to make focus ring drawing easier.  See:
> 
> <http://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKit.html>
> 
> I've been experimenting with it, and it works great, though I have seen it 
> frequently appear as an offender when profiling with Instruments.
> 
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 s...@rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to