Re: Drawing focus rings
Re: Drawing focus rings
- Subject: Re: Drawing focus rings
- From: Tony Romano <email@hidden>
- Date: Sat, 18 Jun 2011 11:14:57 -0700
- Thread-topic: Drawing focus rings
You will need this as well.
- (BOOL) resignFirstResponder
{
...
// Invalidate the area around the focus ring
[self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
...
}
Tony Romano
On 6/18/11 10:19 AM, "Lee Ann Rucker" <email@hidden> wrote:
>>From the sample code in ClockControl.m :
>
> // If we have focus, draw a focus ring around the entire cellFrame
>(inset it a little so it looks nice).
> 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];
> }
>
>----- Original Message -----
>From: "Peter Hudson" <email@hidden>
>To: email@hidden
>Sent: Saturday, June 18, 2011 3:32:49 AM
>Subject: Drawing focus rings
>
>I need to draw a focus ring ( or something that looks like a focus
>ring ) around a group of rows in an NSTableView.
>
>Drawing a rectangle with NSBezierPath works fine - how do I make it
>look like a focus ring ?
>
>Peter
>_______________________________________________
>
>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
>_______________________________________________
>
>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
>
_______________________________________________
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