Forum Archive

how to give focus to a textfield in the "Custom UI" action

DrNo152

Is there a way to give focus to a textfield in the "Custom UI" action other than manually tapping to it if it pops up? That is, I would like to tell the action to let the cursor blink and to show the keyboard right from the start.

omz

It's only possible via Python. E.g. if your text field's name is "textfield1", you could use a script action like this as part of an action workflow in a Custom UI:

import workflow
import ui
root_view = workflow.get_view()
textfield = root_view['textfield1']
textfield.begin_editing()
DrNo152

Great, thanks. That does the job.