Using keyboard to submit text

24 views
Skip to first unread message

veronica stanley-hooper

unread,
Jun 1, 2017, 3:51:43 PM6/1/17
to MIT App Inventor Forum
I am working on a math game for my elementary school students. I have a text box where the student will enter their answer for the math problem on the screen. Naturally the phone keyboard pops up when the student begins to enter their answer. Is there a way that their answer can be submitted using the DONE button on the phone keyboard? Right now the student must touch the DONE on the keyboard and then the SUBMIT button that I designed for the app.

Thank you!
Screenshot_20170601-123956.png

SteveJG

unread,
Jun 1, 2017, 4:08:53 PM6/1/17
to MIT App Inventor Forum
Probably. If your Submit button were also visible on this screen, the user could press submit and avoid pressing done.

It should work without Done, depending on what code you have and whether you use the call TextBox.HideKeyboard block somewhere.

Does it?  ..your Submit must be visible.

Regards,
Steve

veronica stanley-hooper

unread,
Jun 1, 2017, 4:15:48 PM6/1/17
to MIT App Inventor Forum
Yes. It does submit using my "check answer" button. I had my daughter test out the app last night and one of the 'frustrating' things for her was the keyboard done button doesn't submit her answer it just hides the keyboard. I was hoping to figure out some code to have the DONE button submit the text as well as the CHECK ANSWER button...that way whichever button the student chooses would submit their answer.

SteveJG

unread,
Jun 1, 2017, 5:28:17 PM6/1/17
to MIT App Inventor Forum
Done is done .. there is no event handler to do what you hope to do.     Text boxes are usually used with the Button component, with the user clicking on the button when text entry is complete.  http://ai2.appinventor.mit.edu/reference/components/userinterface.html#TextBox

Users have used various gimmicks to avoid this issue and avoid Done: Using a Clock object they count the   length of the Text box and if 1 digit do... or 2 digits do ... or 3 so the clock is continually checking the length of the textbox..when the checking finds the expected number of digits, the event handler in the Clock automatically 'submits'...  It woud require the user to enter 001  or 021  or 100   for 1 or 21 or 100. It would work...

I am not sure you understood what I said...   the user does NOT have to use the Done button; she/he can go directly to your Submit button and the Submit will use whatever values were input on the keyboard.
That will give a single button submittal, however there is no way to re-purpose Done.


veronica stanley-hooper

unread,
Jun 1, 2017, 9:10:10 PM6/1/17
to MIT App Inventor Forum
I understand. There is also the visual issue of a black screen where the pop-up keyboard was when the user goes directly to the 'submit' button instead of tapping the keyboard 'done' button first. I was hoping to solve both problems by getting the 'done' button to submit the answer. Perhaps I will avoid the keyboard all together and make the answer multiple choice with buttons instead. Thanks for your help! 

Smiles,
Veronica

Abraham Getzler

unread,
Jun 2, 2017, 11:42:23 AM6/2/17
to MIT App Inventor Forum
You already have buttons for 10 digits, an erase function and a Done button.

So you don't need a Text box for the data entry, just a label!

You can fake the appearance of a cursor using a "|" at the end of your label text,
even blinking under Clock control.

ABG

Reply all
Reply to author
Forward
0 new messages