I need your help. I create input text field via native.newTextField() also I add event listener on 'key' for detect hardware "Back" button pressed. When I edit input text field and press Back button I didn't catch this event. How can I solve this? Maybe something check open or not hardware keyboard.
Thanks.
It will never receive it.Check the doc of Corona SDK. They say "Key events will not be received if a native object such as a TextField, TextBox, or WebView handles them."
Related
We need to achieve functionality where user can not type OTP manually , so we don't want to give user an option to enter OTP , rather we want to use one tap feature of keyboard from IOS 12 , where user can tap on suggestion displayed over keyboard and OTP filled automatically . So can we hide keyboard but suggestion OTP still being displayed?
Today I stumbled upon a problem with a LostFocus event from a TextBox that didn't fire. Most clients didn't have any problems but a small portion of them reported unexpected behavior. After some research I found that the clients who didn't had the problem clicked on the "Ok" button with the mouse while the other clients pressed Enter on their keyboard. The "Ok" button was the default button on the Form so pressing Enter should work just fine. The problem is that pressing Enter doesn't fire a LostFocus event on the TextBox with focus.
After some Googling it was pretty clear that this is the expected behavior of a default button. The focus never loses the TextBox and the code behind the CommandButton Click event is being run without it being clicked.
How to get the LostFocus event to fire when using a default button?
A simple hack that worked for me is to set the focus to the "Ok" button whenever the Click event is being fired. That way the current control automatically runs its LostFocus event. Don't forget to put an extra DoEvents after setting the focus. Otherwise the LostFocus event fire after your other code has been executed.
Private Sub cmdOk_Click()
cmdOK.SetFocus
DoEvents
'Run your other code
End Sub
I'm building chat application for mobile devices with Adobe Flash Builder 4.6.
I have s:TextInput for message entering and s:Button for sending message.
When user enters message and taps "Send" keyboard goes down. I want to keep it opened.
I can use textInput.setFocus() and setFocus with setTimeout(), but it gives unexpected results sometimes. For example soft keyboard can jump or goes down without resizing stage.
Could you recommend good solution for keeping soft keyboard opened when taping outside text input (focus should left in text input).
What worked for me was:
Create a listener for the TextInput focus out event
Put textInput.setFocus() code in that listener handler
When I want the textInput to be able to focus out for specific cases I create a lockFocus variable for the listener to check first before deciding to reassign focus or not.
Hope that helps!
I have looked at example code that uses the native textField on Android. I would like to be able to type into the text field without having to touch a button to show the text field, and then touch inside the text field to start typing. Is there a way to show the text field and set focus to it, where I can start typing without touching other buttons. I am working on an app and I don't want the users to have to take extra steps to begin typing text. Thanks for any advice.
You can call native.setKeyboardFocus(yourField) to show the keyboard.
http://docs.coronalabs.com/api/library/native/setKeyboardFocus.html
I am trying to capture a key press on the return key. How do I set up event listener for the enter key. So far I can't find anything in the Blackberry docs about onKeyListener or anything like it.
All I want is to process 2 EditFields once the enter key is pressed.
Thanks,
MD
You will have to use a KeyListener plus the KeyPad class to compare the key pressed with the keypad.