I did some more research and the problem seems to be that there is no
selected_range method on the
TextField. Is there an equivalent method that I'm missing? Thanks.
Latest posts made by Jonstieg
RE: How to select all text in text box on tap
Thanks. This code works really well but I am having a tough time applying it to my code, which has TextFields. Here is a bit of my code, which uses a .pyui:
import ui from functools import partial class golfApp(ui.View): ... def textfield_did_begin_editing(self, textfield): r = (0, len(textfield.text)) ui.delay(partial(setattr, textfield, 'selected_range', r), 0) ... v=ui.load_view('golf') v.delegate = MyTextFieldDelegate() v.present(style='full_screen', orientations='portrait')
Any idea what I'm doing wrong? Thanks so much.
How to select all text in text box on tap
I'd like to select all the text in a text box whenever I tap on it and I just can't find any information on how to do it.
Is there a method to select/highlight all the text? Is there a way that I could simulate sending the Command + A keys?
Remove focus from text field/resign keyboard
I have a UI with three text fields and one button. All three text fields use the Number Pad keyboard, which don't have a Return key to hide the keyboard.
What I'm looking for is that when I tap the button, the text field that has the focus (one always does), loses focus. I don't know which text field will have the focus when the button is tapped.
All the text field implement delegates.
My first thought was to send a simulated return key with the button tap, but I couldn't figure out how to do this. I tried the textfielf.end-editing() with a couple of different delegate methods, but it didn't work.
Can anybody suggest a way to remove the focus from a text field?