Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upDetecting enter pressed on iOS software keyboard. #1868
Comments
|
To me, "Done" doesn't mean new line, it means close the keyboard. |
|
But it would be good to know about that that press just to unfocus field or commit text change. |
|
+1. Before updating to the latest libGDX, we were sending \n to the input processor when the keyboard went away so that we could handle the text |
|
Same problem here.. I need the user to be able to type "Enter" and to listen to the event.. Done key is useless as it doesn't triggers anything and just closes the keyboard (something easily done with code). When programming In xCode its child's play to change the keyboard layout type but in libgdx it has being a pain in the ass. Please switch the default layout to "enter" key so we can actually do something with that big button. |
|
I think it would be best to expose the UITextField with a public getter, so everyone can change the attributes of the text field (like keyboard layout) on the fly. Or at least some public methods that allow setting the keyboard type in IOSInput. IOSInput input = (IOSInput)Gdx.input;
UITextField textField = input.getHiddenTextField();
textField.setKeyboardType(UIKeyboardType.NumberPad); |
|
Yes, that would be great, +1 |
|
This should not be a platform specific offering as Android has the same need. I've been wanting to revamp the on-screen keyboard implementation to expose this functionality through the Input interface. |
|
Hi Everyone, I have a regular text field in my code, and im trying to capture the "done" key in the listener of my textfield for the iOS keyboard but it doesn't work. For android i just compare it to '\n' and it does work. Does anyone know if this has been implemented for iOS? Thanks!! mTextField = new TextField("", styleTextField);
mTextField.setTextFieldListener(new TextFieldListener() {
@Override
public void keyTyped(TextField textField, char key) {
boolean enterKey = key == '\n';
LogUtil.i("enterKey: " + enterKey);
}
}); |
|
The char 13 is fired as a keyTyped event, also a keyDown event is fired with the key: Keys.ENTER |
|
Im sorry, i didn't get it quite well... the keyDown event is not fired when clicking the 'done' button of the ios keyboard. Thanks in advance Tom! |
|
This is where these events are fired https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java#L415 You should be able to do |
|
Oh perfect! It worked! thank you very much! |
|
Thank you Tom-Ski for finally merging the thing, never got the chanse to thank you |
Pressing "Done" button while RoboVM software keyboard is up should trigger keyDown() or keyTyped() event. Currently most of custom textfields (just like the one from flixel-gdx) don't work because "Done" button just closes virtual keyboard without triggering any event. Invoking keyTyped for '\n' keycode would be a nice idea.