Key Events not trickling up

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

Key Events not trickling up

Postby jwitt » Wed Mar 27, 2013 5:44 pm

We are taking a look at mollett's report of events not always being managed correctly:

I have noticed that key events don't always seem to trickle up to a parent element. I have run this code on a D40 with firmware 1_3_0_1_53901. The attached code attaches handlers for key left and key right. There are also soft keys for Next and Prev (corresponding to left and right). When changing direction (like from left to right), it requires to presses of the dpad key to cause the onkey event to fire. No such issue is exhibited when using the soft keys.

To reproduce:
1- create test.js and app.json from snippets below
2- create test.zip file
3- upload to phone
4- run application
5-note that right arrow key must be pressed twice in order to move from initial screen. also not in debug window that only one "prevVerse" event fired, despite the 2 key presses.
6- close application and relaunch
7- press the "Prev" soft key one time and note that the screen changes.
jwitt
Newsterisk
 
Posts: 4
Joined: Tue Apr 28, 2009 9:43 am

Re: Key Events not trickling up

Postby mollett » Mon Apr 01, 2013 12:13 pm

If it makes it easier, here is the minimal app that shows what I meant.
Attachments
test.zip
Minimal app
(2.62 KiB) Downloaded 634 times
mollett
Newsterisk
 
Posts: 25
Joined: Mon Apr 01, 2013 12:03 pm

Re: Key Events not trickling up

Postby sruffell » Tue Apr 02, 2013 9:44 am

mollet,

Thanks for the attaching that zip file. I tried it out and was able to confirm what you reported. So, as you reported, something is specifically interfering with the arrow keys on the dpad. As long as you don't need your phone app to process those keys you should be good.

But....I'll look into it (probably tomorrow) and see if I can find out what is really happening. Let me know if this is holding up any development that you're working on.

Cheers,
Shaun
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm

Re: Key Events not trickling up

Postby mollett » Wed Apr 03, 2013 10:45 am

Shaun,
This is not holding me up in the least! I've got my app written, but the client won't be getting it until the end of the month. And, I can disable the arrows and just use the soft keys if I need to. Thanks!

Vic

P.S. Did you happen to notice the excessive amount of padding at the bottom of the scroll box?
mollett
Newsterisk
 
Posts: 25
Joined: Mon Apr 01, 2013 12:03 pm

Re: Key Events not trickling up

Postby mattdimeo » Fri Apr 12, 2013 2:16 pm

The problem here is that the code uses genericMenu, probably just to set softkeys. genericMenu creates a List widget, which in this case is left empty. Empty lists have a bug where a right or down key gets consumed (basically moving from a no-selection-yet state to selecting row 0).

I'd recommend using window.setSoftkeysByList to set up softkeys in your application instead of using an empty genericMenu. We'll look into fixing the empty List bug in a future revision.

Shaun has a fixed version of the bug report code here: https://gist.github.com/sruffell/5374083

setSoftkeysByList description is here http://phones.digium.com/phone-api/reference/methods/setsoftkeysbylist
mattdimeo
Newsterisk
 
Posts: 2
Joined: Wed Apr 03, 2013 1:25 pm

Re: Key Events not trickling up

Postby mollett » Mon Apr 15, 2013 7:54 am

That approach works beautifully, Matt. Here's a reference implementation...
Attachments
test.zip
Using setSoftkeysByList rather than genericMenu.
(2.46 KiB) Downloaded 580 times
mollett
Newsterisk
 
Posts: 25
Joined: Mon Apr 01, 2013 12:03 pm


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 0 guests