Hi Adam,

That was a typo. Here's what I have :

public function myKeyDown(event:KeyboardEvent):void {


}

And I have specified the event listener in the DG as 
<mx:DataGrid ... keyDown="myKeyDown(event)">

The problem is not with the Event generation. I have put trace and it
seems to call the function when the event occurs. The problem is
detecting the CTRL + <keycombination>.

The keyCode always returns 17 (for CTRL key) and the ctrlKey is TRUE.
What happens to the keyCode of the other key , for Ex: C or c which
would be 67 or 99 ???

Is there any other way of detecting it, which I am not aware or is
this a Flex bug ? It does not work as suggestec in the Flex help docs.




--- In flexcoders@yahoogroups.com, "Adam Royle" <[EMAIL PROTECTED]> wrote:
>
> Umm... you've got 
> 
> public void myKeyDown
> 
> when it should be:
> 
> public function myKeyDown...
> 
> and make sure you have
> 
> <mx:DataGrid ... keyDown="myKeyDown(event)"
> 
> 
> Adam
> 
>   ----- Original Message ----- 
>   From: jmorpher03 
>   To: flexcoders@yahoogroups.com 
>   Sent: Monday, March 05, 2007 9:11 PM
>   Subject: [flexcoders] Re: ctrl key with a combination - doesnt
seem to work
> 
> 
>   Does anyone know how the the CTRL + <key combination> work ? Is this a
>   Flex bug ? The Flex sample code in the help docs talks about this, but
>   it doesn't seem to work. Whats wrong ???
> 
>   --- In flexcoders@yahoogroups.com, "jmorpher03" <asgartali@> wrote:
>   >
>   > Hi,
>   > 
>   > I am trying to trap the ctrl key along with a combination of any
other
>   > alphanumeric key by using the following code on a DataGrid control:
>   > 
>   > public void myKeyDown(event:KeyBoardEvent):void {
>   > if ( event.ctrlKey && event.keyCode == 67 ) // for 'C'
>   > {
>   > // copy selected row
>   > }
>   > }
>   > 
>   > This does not seem to work. Nor is any other key combination
detected
>   > when we use the ctrl key. 
>   > 
>   > Isnt this the way to handle keyboard events ? Is there any other
>   > explicit way to handle it ?
>   > 
>   > Regards,
>   > Asgar.
>   >
>


Reply via email to