Conrod: No way to manually focus a TextBox

Created on 19 Aug 2017  路  4Comments  路  Source: PistonDevelopers/conrod

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.

Most helpful comment

@mitchmindtree Any updates on this?

All 4 comments

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:

  1. event::Ui::WidgetUncapturesInputSource(id, source) where id is the id of the widget previously capturing the input source
  2. event::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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zengsai picture zengsai  路  10Comments

mitchmindtree picture mitchmindtree  路  5Comments

gkbrk picture gkbrk  路  3Comments

malikolivier picture malikolivier  路  4Comments

alanpoon picture alanpoon  路  4Comments