Re: Hot to move focus to a button?
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. Joanna -- Joanna Carter Carter Consulting ___ 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
Re: Hot to move focus to a button?
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
Re: Hot to move focus to a button?
Hi Ricky All you need to do is properly set up the key view loop in IB. i.e. connect the 'nextKeyView' outlets. ... A very good point. I was assuming that Jonathan already knew this slaps self on wrist :-) and just wanted to set focus to a button, other than by moving through the tab order. Joanna -- Joanna Carter Carter Consulting ___ 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
Re: Hot to move focus to a button?
On Sat, 6 Mar 2010 16:25:57 -0800, Kyle Sluder kyle.slu...@gmail.com said: On Sat, Mar 6, 2010 at 12:20 PM, Jonathan Chacón tyflos2...@gmail.com wrote: How can I move the keyboard focus to a control? Buttons don't accept keyboard focus They do on my machine. It all depends on how the user has set up Full Keyboard Access in the Keyboard prefs. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ 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
Re: Hot to move focus to a button?
On Sun, Mar 7, 2010 at 11:44 AM, Matt Neuburg m...@tidbits.com wrote: On Sat, 6 Mar 2010 16:25:57 -0800, Kyle Sluder kyle.slu...@gmail.com said: Buttons don't accept keyboard focus They do on my machine. It all depends on how the user has set up Full Keyboard Access in the Keyboard prefs. m. Okay, but that is not the default configuration. The OP cannot rely on this behavior. --Kyle Sluder ___ 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
Hot to move focus to a button?
Hello, I'm trying to move keyboard cursor to a button but NSButton hasn't a setFocus method. How can I move the keyboard focus to a control? thanks Regards Jonathan Chacón Barbero Accessibility, usability and new technologies consultant Phone: +34 679953948 e-Mail: jonathan.cha...@telefonica.net Blog: http://programaraciegas.weblog.discapnet.es Twitter: http://www.twitter.com/jonathanchacon LinkedIn: http://es.linkedin.com/in/jonathanchacon Facebook: http://www.facebook.com/jonathan.chacon.barbero Messenger: tyf...@hotmail.com Skype: Tyflos_ Ping for iPhone: jchacon ___ 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
Re: Hot to move focus to a button?
Hi Jonathan I'm trying to move keyboard cursor to a button but NSButton hasn't a setFocus method. How can I move the keyboard focus to a control? [window makeFirstResponder:theButton]; Joanna -- Joanna Carter Carter Consulting ___ 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
Re: Hot to move focus to a button?
On Sat, Mar 6, 2010 at 12:20 PM, Jonathan Chacón tyflos2...@gmail.com wrote: How can I move the keyboard focus to a control? Buttons don't accept keyboard focus. See the documentation for -[NSView canBecomeKeyView] and the related conceptual documentation. --Kyle Sluder ___ 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