• 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 13:50:42 +0100

I guess you're right about the path around buttons, this might be hard to find out. :-(

I have a panel in my application with a textField, and an OK-button to dismiss the panel. So this is a kind of default button.

However, when user presses <ENTER>, the textField is firstResponder and a "newline" is inserted. I would like to keep this behavior.
When user presses <ALT+ENTER>, OSX preforms the action of the default button, in my case the OK-button.

So, since the default button does not react on the <ENTER> but does react on the <ALT+ENTER>, it seems fair to draw a focusring for the button, instead of displaying the default button in blue.

In the OSX installer there's a focusring for the OK-button, but as I understand from you there's no option in the framework yet?

On 17 feb 2004, at 10:30, Alastair Houghton wrote:

On 17 Feb 2004, at 07:30, Ruben Smits wrote:

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?

Well, buttons aren't really drawn with NSBezierPath (they're just bitmaps), and there's nothing to say that Apple won't change them at any arbitrary time in the future... Basically, you're going to have to either (a) guess and hope it doesn't change too much or (b) use some sort of tracing algorithm to recover an appropriate path from the rendered button. (a) is simple. (b) is far too complicated to describe here (find some books on computer vision if you really want to go for this approach).

Why are you trying to draw a focus ring around the button anyway? Have you looked at the "Full keyboard access" feature? (Look in Keyboard & Mouse in System Preferences.) If you're just doing this in a "normal" application, then you probably shouldn't... unless full keyboard access (Ctrl-F7) is enabled, then the user has indicated a preference for *not* having focus rings around buttons in dialog boxes.

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>)
 >Re: focus ring around button (From: Ruben Smits <email@hidden>)
 >Re: focus ring around button (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Plug-in?
  • Next by Date: Re: focus ring around button
  • Previous by thread: Re: focus ring around button
  • Next by thread: Re: focus ring around button
  • Index(es):
    • Date
    • Thread