Re: Drawing the focus ring
Re: Drawing the focus ring
- Subject: Re: Drawing the focus ring
- From: Sam Wilkins <email@hidden>
- Date: Mon, 13 Jun 2005 17:17:31 -0400
On 6/13/05, Ricky Sharp <email@hidden> wrote:
> On Jun 13, 2005, at 12:19 AM, Sam Wilkins wrote:
>
> > I'm having a bit of a problem drawing the focus ring around a custom
> > view I'm writing. I'm calling setFocusRingType: with
> > NSFFocusRingExterior in my init method, and
> > setKeyboardFocusRingNeedsDisplayInRect: with [self frame] at the end
> > of my drawRect:, but I'm not having any luck. Any help would be
> > appreciated.
>
> Take a look at the ClockControl example code. It draws the standard
> keyboard focus around a custom control (view).
>
> ___________________________________________________________
> Ricky A. Sharp mailto:email@hidden
> Instant Interactive(tm) http://www.instantinteractive.com
>
>
It doesn't seem to working, I should be able to tab over to the
control and then operate it with the keyboard, right? I know I didn't
modify the code.
if ([self showsFirstResponder]) {
// showsFirstResponder is set for us by the NSControl that is drawing us.
NSRect focusRingFrame = clockRect;
focusRingFrame.size.height -= 2.0;
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame,4,4)] fill];
[NSGraphicsContext restoreGraphicsState];
}
I'll try using that block of code from the sample. If I can't make it
work, I'll let you know.
_______________________________________________
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