Page 1 of 1

Force keypad to stay open on card...

Posted: Sun Oct 16, 2016 8:57 pm
by tj333
I have recently been trying to get my app working on Android. I have a card where the user inputs numbers and I use the numeric keypad.

It all works fine except...

If the user navigates away from the app, say by pressing the hard "home" button on Android, does some stuff then returns to the app, the keypad is no longer displayed. I added code so that the keypad pops up when the user taps on the input field, but in this case the field already has focus so even tapping on the field will not bring up the keypad unless you click somewhere else first to take focus off the field, then back on the field, which most users would find both confusing and annoying.

When looking for a solution I did see some mention of using "focus on nothing", however in this case I am not sure where you would insert the "focus on nothing". Is there a way to have this happen automatically when the user navigates away from the app, such as by pressing the hard "home" button on Android?

I tried adding mobileSetKeyboardType to both OpenCard and PreOpenCard, which works when the user navigates to the card through the app itself. But when a user goes to the home screen on their Android, then back to the app it does not seem to run OpenCard or PreOpenCard, it's as if the user has picked up right where they left, but now the keypad is gone.

Ideally I'd like to be able to force the numeric keypad to stay open when the user navigates away from the app. If this is not possible then a way to force the keypad to launch again when they navigate back to the app would work too. I suppose I could add a button that relaunches the keypad, but I would prefer not to if at all possible.

Thanks for any help or suggestions on this,


Re: Force keypad to stay open on card...

Posted: Mon Oct 17, 2016 9:05 am
by rblackmore245
I had a few nightmares with the keyboard not popping up and not focusing on fields.

In the end I decided to create my own keyboard within the app ( Not ideal ) then I had full control over when the keyboard popped up.

I just created a image of a keyboard and then buttons over each key which would put a letter into a variable and then put this into a selected text field.

global keystring
On mouseup
put "a" after keystring

Re: Force keypad to stay open on card...

Posted: Mon Oct 17, 2016 7:26 pm
by tj333
Thanks for your suggestion, I had not considered making my own keypad, but I guess that would work.

It would be nice if there was a way to make the default Android keypad to work consistently.


Re: Force keypad to stay open on card...

Posted: Mon Oct 17, 2016 8:48 pm
by jacque
I just wrote a response suggesting the app use the "resume" message to send a "focus on nothing" command, but I see that isn't supported on mobile so I deleted the post. On Android the stack remains open until the OS needs the RAM, so when you go back to it, it's still in the same state as before. The OS closes the keyboard when you navigate away, but the app doesn't know that because it thinks nothing has changed.

We need a "resume" message or its equivalent in order to manage the keyboard in these cases. There are messages sent when the user taps the menu or back keys ("menuKey", "backKey") so you could focus on nothing in one of those messages. That should remove the keyboard before the OS has a chance to, and then the user would be required to tap in the field again when returning. However, there is no "homeKey" message so the same problem will persist if the user navigates away by tapping Home.