Maybe searching for an hour in the docs is not enough, but for the life of me I cannot find a way to focus a TextBox without a user clicking on it. I tried to hack around it by simulating an event or something like that but couldn't find a way to do that either.
I assume the state of focus is cached in the UI (in your retained & immediate hybrid model), and I suggest bringing that state to the user of the library similarly to how the user of the library has to handle the contents of the textbox.
You can find some discussion on how we should approach this at #606, however I don't think anything has been settled upon or implemented yet.
Whether or not a widget is focused is tracked within the Ui
's current Global
state by tracking which widget is currently capturing input from each device.
I think a nice way to provide this control to the user would be via a method along these lines: ui.capture_mouse/keyboard_with(widget_id)
which internally emits two events:
event::Ui::WidgetUncapturesInputSource(id, source)
where id
is the id of the widget previously capturing the input sourceevent::Ui::WidgetCapturesInputSource(widget_id, source)
where widget_id
is the ID of the widget specified by the user (in your case the ID for your TextBox) that should now capture the input source.Perhaps we could then use these methods as a foundation for providing higher level helpers for tabbing between input fields, etc.
@mitchmindtree Any updates on this?
Has any consensus been made on how this will be implemented?
Any update on this? I've created a table but manually selecting each element is really tedious.
Most helpful comment
@mitchmindtree Any updates on this?