kotcrab/vis-ui

programmatic keyboard focus to ColorPicker's hex field

Closed this issue · 3 comments

ColorPicker has a private ExtendedColorPicker called picker. ExtendedColorPicker extends BasicColorPicker. BasicColorPicker has a private VisValidatableTextField called hexField. I'd like to be able to programmatically give keyboard focus to the hexField. However, because hexField is private, there's no way to get a reference to it in order to call
Stage.setKeyboardFocus() passing hexField (It also doesn't have name, so there's no way to search for it by name).

This issue is to request adding some way to get access to a reference to the hexField member in order to set the keyboard focus, or to add a method to ColorPicker to request that it set the keyboard focus to the hexField

I guess it makes sense to focus this field on show by default. Same for the FileChooser's selected file text field.

I'm not sure focusing by default would take care of all relevant use-cases. For example, imagine I want to add the hex field to a list of Actors that I'd cycle focus through with the tab button. I'd need to be able to get a reference to the field in order to focus on it in response to certain user inputs.

I've added method for focusing the hex field.