Re: [flexcoders] How to enable the enter key for all buttons onFocus

2008-06-30 Thread dnk


On 27-Jun-08, at 10:57 PM, Alex Harui wrote:

If you set a defaultButton on a container, ENTER will click it.  If  
you tab to another Button, ENTER will click that other button.   
That’s the way Windows does it, and the way we do it in Flex.



That is perfect. Works like a charm!

d




RE: [flexcoders] How to enable the enter key for all buttons onFocus

2008-06-28 Thread Alex Harui
If you set a defaultButton on a container, ENTER will click it.  If you
tab to another Button, ENTER will click that other button.  That's the
way Windows does it, and the way we do it in Flex.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Friday, June 27, 2008 7:11 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How to enable the enter key for all buttons
onFocus

 

First a caveat: I's a bad idea. Pressing enter to submit an entire form
and spacebar to click a specific button is a fairly standard UI
practice, and something you shouldn't change without a good reason.

But if you've got your heart set on it, one option is to subclass
Button, put your code in there and use package:MyButton in place of
mx:Button.

Or, depending on how you're going about it you could probably add a
listener to keyUp on systemManager, check for somebody pressing enter
when the target is a Button, and then simulating a click
programmatically. That's assuming keyUp bubbles, I have no idea if it
does :)

-Josh

On Sat, Jun 28, 2008 at 3:25 AM, dnk [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  wrote:

Good day all,

How would one go about enabling the enter key for all buttons in your
flex app?

I know you an do the defaultKey for a form, or add keyDown to your
button (but that reacts to all keys then - not good).

As it stands now, the spacebar will react to every button onFocus.. .I
was hoping to do that with the Enter key...

d





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups
Links


   (Yahoo! ID required)

   mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 






-- 
Therefore, send not to know For whom the bell tolls. It tolls for
thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  

 



[flexcoders] How to enable the enter key for all buttons onFocus

2008-06-27 Thread dnk
Good day all,

How would one go about enabling the enter key for all buttons in your  
flex app?

I know you an do the defaultKey for a form, or add keyDown to your  
button (but that reacts to all keys then - not good).

As it stands now, the spacebar will react to every button onFocus.. .I  
was hoping to do that with the Enter key...

d




Re: [flexcoders] How to enable the enter key for all buttons onFocus

2008-06-27 Thread Josh McDonald
First a caveat: I's a bad idea. Pressing enter to submit an entire form and
spacebar to click a specific button is a fairly standard UI practice, and
something you shouldn't change without a good reason.

But if you've got your heart set on it, one option is to subclass Button,
put your code in there and use package:MyButton in place of mx:Button.

Or, depending on how you're going about it you could probably add a listener
to keyUp on systemManager, check for somebody pressing enter when the target
is a Button, and then simulating a click programmatically. That's assuming
keyUp bubbles, I have no idea if it does :)

-Josh

On Sat, Jun 28, 2008 at 3:25 AM, dnk [EMAIL PROTECTED] wrote:

 Good day all,

 How would one go about enabling the enter key for all buttons in your
 flex app?

 I know you an do the defaultKey for a form, or add keyDown to your
 button (but that reacts to all keys then - not good).

 As it stands now, the spacebar will react to every button onFocus.. .I
 was hoping to do that with the Enter key...

 d



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]