Hi,
i connected a USB keyboard to my phone and wanted to monitor the input with Taifun's Texbox Extension. The Textchanged event fires, but the EnterPressed event does not.
Is there a way to recognize "Enter"?
Hi,
i connected a USB keyboard to my phone and wanted to monitor the input with Taifun's Texbox Extension. The Textchanged event fires, but the EnterPressed event does not.
Is there a way to recognize "Enter"?
See the examples on my webpage how to do it
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
I have read and followed the examples. The problem does not occur with the android keyboard but when connecting a USB keyboard.
EnterPressed is not recognized on the following devices:
Lenovo TB-X306F Android 10
Samsung Note 10 Android 9
Motorolla moto E20 Android 11
But it is recognized by the device:
Samsung Note 20 Ultra Android 12
However, afterTextChanged is recognized on all devices.
Here are my blocks.
What happens, if you only start an enter pressed listener on that textbox?
Taifun.
The same thing. With the first Enter, the TextBox gets the focus and then nothing happens.
With the Note 20, the TextBox gets the focus and on the second Enter the Notifier announces "enter" .
Is this the same when the app is compiled?
Yes.
my solution is based on this snippet
EditText editText = (EditText) findViewById(R.id.search);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
sendMessage();
handled = true;
}
return handled;
}
});
and I try to detect not only IME_ACTION_SEND, but also IME_ACTION_DONE, IME_ACTION_GO, IME_ACTION_NEXT, IME_ACTION_PREVIOUS and IME_ACTION_SEARCH
unfortunately I can't test this myself becasue I do not have an USB keyboard...
I could modify the logic to find out, if another action id must be used in your case... in case you are interested, just send me a PM, so we can discuss this...
meanwhile I add a note in my documentation, that this listener does not work with USB keyboards
Taifun
is this a multiline textbox?
The listener does not work for multiline textboxes...
Taifun
Oh, sorry. That's a little to high for me.
No.
It's a normal PC USB keyboard, which I unplug from my PC and connect to the phone/tablet with an OTG cable.
a multiline textbox has nothing to do with your keyboard...
from the documentation User Interface
MultiLine
If true, then this
TextBox
accepts multiple lines of input, which are entered using the return key. For single line text boxes there is a Done key instead of a return key, and pressing Done hides the keyboard. The app should call the HideKeyboard method to hide the keyboard for a mutiline text box.
did you check the Multiline checkbox in the properties of the textbox?
Taifun
Multiline is not checked.
Enclosed my aia.
Keyboard.aia (41,8 KB)
I can use both keyboards at the same time. The touch keyboard and the USB keyboard. Entering characters is also possible for both at the same time.
When I press enter on the touch keyboard, the notifier reports. When I press enter on the usb keyboard, the notifier reports nothing.
Hello! Is your problem solved? I have encountered the same problem!
Yes, Taifun send me another extension. Please ask him.
Hello. I have the same problem with bluetooth keyboard.
Is any solution for this?
I sent you a PM
in case the updated version is working for you, I will release it for everyone
Taifun
I am having this problem with a Chromebook.
It looks like I never published an updated version...
Version 6a is now available to download from the Download section here App Inventor Extensions: Textbox | Pura Vida Apps
Taifun
Thanks. That worked perfectly.