Setting focus to a widget

I have a small TextEditor widget in my calculator and would like the TextEditor to have focus initially and basically all the time.

Is there a way to set the widget that will have focus from the view method or elsewhere.

image

The text_input module has a focus operation to programmatically focus any TextInput widget by Id. The text_editor module doesn’t provide such functionality, but I maintain a fork of Iced in which I added that feature since I also need it.

You won’t be able to simply select the widget which should be focused all the time and be done with it. You will need to either re focus it every time it loses focus, or focus it on each keystroke. It should be possible though.

Oh.

I would have thought that functionality would be standard for any widget that can be interacted with. :slightly_frowning_face:

I’m sure it will be eventually. Don’t forget Iced is still very young.