On Mar 7, 2010, at 3:53 AM, Joanna Carter wrote:

> Hi Kyle
> 
>> Buttons don't accept keyboard focus. See the documentation for
>> -[NSView canBecomeKeyView] and the related conceptual documentation.
> 
> I realise this to be what the docs say but, if you use -makeFirstResponder: 
> the focus ring is applied to the chosen button and pressing the spacebar 
> calls the connected action, which is, surely, the desired end result of 
> "setting focus".


All you need to do is properly set up the key view loop in IB.  i.e. connect 
the 'nextKeyView' outlets.

If your UI is something like this:

Prompt: [edit field]

(button1) (button2)


set 'nextKeyView' of 'edit field' to 'button1'.  Then, 'button1' to 'button2' 
and finally 'button2' back to the 'edit field'.

Also, ensure to set the first responder as needed.

When Full Keyboard Access is off, users will only be able to tab amongst 
controls that are text boxes or lists.  Otherwise, when on, they will be able 
to tab amongst all controls.

You should get automatic behavior 99% of the time (i.e. you never have to call 
makeFirstResponder: manually).  There are cases where you need to do so when 
you have very complex UI involving tabless tabviews (usually nested).  In 
response to selected tab changes, you can "rewire" the keyloop manually as 
needed and re-establish the current control that should have focus.
___________________________________________________________
Ricky A. Sharp         mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to