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" <lruc...@vmware.com> 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" <peter.hud...@mac.com>
>To: cocoa-dev@lists.apple.com
>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 (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:
>http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
>
>This email sent to lruc...@vmware.com
>_______________________________________________
>
>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:
>http://lists.apple.com/mailman/options/cocoa-dev/tonyrom%40hotmail.com
>
>This email sent to tony...@hotmail.com
>


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to