This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Is it possible to dismiss the textfield keyboard?
I set up a text field with the gui design tool and then add keyboard_type = KEYBOARD_NUMBER_PAD after it is loaded. When the user selects the field the keyboard pops up right on schedule. How do I make it go away? I've found callbacks in the doc that get called when the keyboard frame changes but can't find anything that suggests why it would change.
Sorry. I should have said that I am running on an iPhone.
JonB last edited by
Isn't there enter or go button on the number pad? Ipad always shows the same keyboard, so I can't test.
You should be able to either tap out of the textfield to change focus, or if you have a delegate
textfield_should_changeyou could call
end_editingto dismiss the keyboard and drop editing (for instance after a certain number of digits are typed)
There is no enter button on the iPhone number pad. For that matter there isn't one on the default keyboard. There is a return button. No amount of taping outside the textField makes the keypad go away. That is probably as it should be in the default case. There a couple of possible use cases so it should be explicitly controlled by the code.
end_editing() makes the keypad go away once I figured out which object to call it on. Thanks. That's what I was looking for. It solves my problem.
Note: end_editing() should be added to the TextView documentation. I can't be the only one that needs it. I looked for such a method in the doc before posting this question. Now that I know the method name I searched for it explicitly to see if I just missed it. I don't see it described anywhere though it is called without description in a delegate example.
I just realized what you said about the iPad keypads. Does that mean changing the keyboard_type doesn't show the numeric keypad? That sounds like a bug. That keypad is a valuable feature on both platforms.
JonB last edited by
Correct, on ipad only the full size keyboards seem to be available, though some of the web/email specific ones do work.
There are a number of methods and properties in ui module where the documentation is not quite complete. Version 1.5 was somewhat more rushed because apple forced omz to submit an update or have the app removed, so I suspect that is part of it. In this case, it is mentioned, here, but not directly
Well maybe this thread will be sufficient documentation until Ole gets a chance to update the doc. You mention a "number of methods and properties" lacking documentation. I wonder if anyone is maintaining a list?
Not supporting numeric keyboards on iPad for numeric fields is a pain. I'll probably have to add value checking for iPad. With the dedicated keypad the user can only type numbers. Now I only test for blank or if the number is in a valid range. I guess I have to steal my wife's iPad some time and investigate.