Re: focus ring around button
Re: focus ring around button
- Subject: Re: focus ring around button
- From: "Julien Guimont" <email@hidden>
- Date: Tue, 17 Feb 2004 18:45:10 -0500 (EST)
Hello,
Well I don't think it is a good idea to do so but you can try to set the
focus ring type of the view (with setFocusRingType:) to
NSFocusRingTypeExterior. I think it would do it. I'd test it, but I'm not
home for now!
Thank you!
Julien Guimont
www.juggysoft.com
>
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.