Re: PDFView focus ring
Re: PDFView focus ring
- Subject: Re: PDFView focus ring
- From: Martin Hewitson <email@hidden>
- Date: Sun, 05 Feb 2012 06:10:26 +0100
OK, I implemented Graham's solution and it works very well in my situation. The PDFView in question is not flush with any of the edges of a window, so I don't need to worry about that here.
Thanks, Graham. Thanks, all!
Martin
On 5, Feb, 2012, at 02:20 AM, Quincey Morris wrote:
> On Feb 4, 2012, at 16:17 , Graham Cox wrote:
>
>> The way I've done this is to handle the focus ring in the view's -drawRect method. You need to focus on the superview so you can draw outside your frame, but that's not a problem - just do it after you've drawn the rest of your normal content.
>
> The one issue this doesn't solve is that of making room around the view to draw the focus ring. If one or more edges of the view are flush with the edge of the window, the exterior ring looks ugly.
>
> In the past, I've sometimes taken the approach of drawing the focus ring *inside* the view. (Use the view bounds rect, inset by 1.0, to draw the focus ring, and don't lock focus on the superview, of course.) It looks pretty good -- it's slightly transparent so it doesn't obscure the content much. However, with this approach, there's apparently no way to take advantage of the spiffy new Lion methods for focus rings. It's also less than ideal during an inertial scroll "bounce".
>
>> The only other thing I've found necessary is to track whether the focus ring needs an update or not by using -setKeyboardFocusRingNeedsDisplayInRect:[self bounds] which I call from -becomeFirstResponder and -resignFirstResponder.
>
> I think you also need to force an update when the app is deactivated. The window is still the key window, but the focus ring shouldn't be drawn.
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden