• 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
Re: focus ring around button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: focus ring around button


  • Subject: Re: focus ring around button
  • From: Ruben Smits <email@hidden>
  • Date: Tue, 17 Feb 2004 08:30:02 +0100

Hi,

Thanks for your reply.

I tried this method indeed and it draws a kind of focusring. However, the method bezierPathWithOvalInRect results in an incorrect path. It is an oval indeed, but the button it is supposed to draw around is not an oval.

So, this solution might work, as soon as I can find out the correct NSBezierPath for the button. (To be exact: I am using the "small" kind of button in Interface Builder.) I can't use the rect of the button, because that results in a rect path.

Any idea how to find the correct NSBezierPath around the button?


On 16 feb 2004, at 18:33, Alastair Houghton wrote:

On 13 Feb 2004, at 08:23, Ruben Smits wrote:

Hi,

How do I draw a focus ring around a "default" button? The method setFocusRingType() creates a rectangular focus around a control, while a button should have an oval ring.

I tried the bezierPathWithOvalInRect: method to draw my own focus, but this method does not return the path around the button.

Any ideas?

Try something like

// Save graphics state
[NSGraphicsContext saveGraphicsState];

// Draw a focus ring (note that you *fill* the path to do this)
NSSetFocusRingStyle (NSFocusRingOnly);
[[NSBezierPath bezierPathWithOvalInRect:myRect] fill];

// Restore the graphics state
[NSGraphicsContext restoreGraphicsState];

Obviously you might need to use some other path, depending on the exact shape of your button.

Kind regards,

Alastair.




-----------
Ruben
-----------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: focus ring around button
      • From: Alastair Houghton <email@hidden>
References: 
 >focus ring around button (From: Ruben Smits <email@hidden>)
 >Re: focus ring around button (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Modal window help
  • Next by Date: How to use color panel to change color of font effects?
  • Previous by thread: Re: focus ring around button
  • Next by thread: Re: focus ring around button
  • Index(es):
    • Date
    • Thread