How to set focus to a textfield was subject of an earlier forum discussion. The solution that was given is to call textfield.begin_editing() (as present in the delegate). This method is not implemented in the current version of Pythonista. Instead there are textfield_did_begin_editing and textfield_should_begin_editing. I used both methods to give focus to a textfield, without result. So, is it still possible to give focus to a textfield? If yes, what do I wrong?
Forum Archive
How to set focus to textfield (2)
PetervdKamp
Jan 25, 2015 - 09:07
dgelessus
Jan 24, 2015 - 20:03
Interesting. I thought I was only imagining things when I thought that there was a begin_editing method before, but it seems that that method was removed at some point.
JonB
Jan 25, 2015 - 03:22
What are you considering the 'latest version'? 1.6 beta, or 1.5?
Although begin_editing is missing from the docs, in 1.5 it is present for both TextView and TextField. Note that this method is called on the TextField object, not on the delegate!
t=ui.TextField()
t.begin_editing()
t.present()
PetervdKamp
Jan 25, 2015 - 09:07
Thanks JonB, your solution did the trick. It didn't come to my mind to call it on the TextField object, because I was convinced that it should be called from the delegate. Kind of tunnel vision…..
Thanks again.