Strange behavior when drawing a focus ring
Strange behavior when drawing a focus ring
- Subject: Strange behavior when drawing a focus ring
- From: Eric Morand <email@hidden>
- Date: Mon, 5 Jun 2006 23:54:53 +0200
Hi guys,
I've created a subclass of NSButton (and its associated NSButtonCell)
and I'm encountering a strange problem with the focus ring. This
problem has already been talked in this list with no solution found.
Here is how I draw my focus ring if the drawInterior... method of my
custom cell :
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)
controlView
{
NSBezierPath * path = nil;
cellFrame = NSInsetRect(cellFrame, 0.5, 0.5);
path = [NSBezierPath bezierPathWithOvalInRect:cellFrame];
// Some drawing here...
if ( [self showsFirstResponder] )
{
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[path fill];
[NSGraphicsContext restoreGraphicsState];
}
}
Everything works fine, the focus rings draws perfectly when I loop
through my buttons with Tab. But, when I press the button while it is
the first responder (when the focus ring is drawn around the button),
it is like the focus ring is drawn again above itself...and it looks
ugly !
Am i doing something wrong in my code ? Note that my custom button
returns NO to isOpaque (since it draws some of its parts with alpha).
Thanks,
Eric.
_______________________________________________
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