librelist archives

« back to archive

Melomel key_press correct usage?

Melomel key_press correct usage?

From:
Gene Moore
Date:
2011-09-09 @ 19:46
Hope this isn't a dumb question, but I'm still new to using Melomel.  I 
want to send arrow keys to a component.  But it was unclear how to do this
with key_press.  I tried this:

menuBar =   Melomel.find("mx.controls.MenuBar", :id => 'mainMenuBar')
Melomel.key_press(menuBar, '37', {'keyCode' => '37'})

 But it didn't seem to do anything.  Is this the correct approach?  Thanks.

-Gene


Gene A. Moore
UI Engineer
gmoore@liveworld.com
(831) 428-1113

Re: [melomel] Melomel key_press correct usage?

From:
Ben Johnson
Date:
2011-09-09 @ 20:58
Gene-

I believe the problem is that you're passing in the key code as a string 
which Melomel will try to convert into a character code. Take out the 
quotes and it should work. Also, the properties hash that you're sending 
the keyCode with is not needed.

Try this:

Melomel.key_press(menuBar, 37)


Ben


On Sep 9, 2011, at 1:46 PM, Gene Moore wrote:

> Hope this isn't a dumb question, but I'm still new to using Melomel.  I 
want to send arrow keys to a component.  But it was unclear how to do this
with key_press.  I tried this:
> 
> menuBar =   Melomel.find("mx.controls.MenuBar", :id => 'mainMenuBar')
> Melomel.key_press(menuBar, '37', {'keyCode' => '37'})
> 
>  But it didn't seem to do anything.  Is this the correct approach?  Thanks.
> 
> -Gene
> 
> 
> Gene A. Moore
> UI Engineer
> gmoore@liveworld.com
> (831) 428-1113
> 
> 

Re: [melomel] Melomel key_press correct usage?

From:
Gene Moore
Date:
2011-09-09 @ 21:17
Ben,
    Thanks, that worked perfectly!

-Gene

On Sep 9, 2011, at 1:58 PM, Ben Johnson wrote:

> Gene-
> 
> I believe the problem is that you're passing in the key code as a string
which Melomel will try to convert into a character code. Take out the 
quotes and it should work. Also, the properties hash that you're sending 
the keyCode with is not needed.
> 
> Try this:
> 
> Melomel.key_press(menuBar, 37)
> 
> 
> Ben
> 
> 
> On Sep 9, 2011, at 1:46 PM, Gene Moore wrote:
> 
>> Hope this isn't a dumb question, but I'm still new to using Melomel.  I
want to send arrow keys to a component.  But it was unclear how to do this
with key_press.  I tried this:
>> 
>> menuBar =   Melomel.find("mx.controls.MenuBar", :id => 'mainMenuBar')
>> Melomel.key_press(menuBar, '37', {'keyCode' => '37'})
>> 
>>  But it didn't seem to do anything.  Is this the correct approach?  Thanks.
>> 
>> -Gene
>> 
>> 
>> Gene A. Moore
>> UI Engineer
>> gmoore@liveworld.com
>> (831) 428-1113
>> 
>> 
>