• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange behavior when drawing a focus ring
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Re: providing Apple Help in cocoa app
  • Next by Date: Re: nsslider subclass not responding to mouseUp:
  • Previous by thread: [SOLVED] Re: Weird Exception While Resizing NSWindow
  • Next by thread: what is ABMetaDataController and why is it raising an exception?
  • Index(es):
    • Date
    • Thread