UX improvements for showTextInput (#1290)
* Added keyDown support for showTextInput (Enter, Escape, Back) * Removed unnecessary "this" * Added cursor autofocus on showTextInput
This commit is contained in:
@@ -307,7 +307,19 @@ public class UI implements ApplicationListener, Loadable{
|
||||
hide();
|
||||
}).disabled(b -> field.getText().isEmpty());
|
||||
buttons.addButton("$cancel", this::hide);
|
||||
}}.show();
|
||||
keyDown(KeyCode.ENTER, () -> {
|
||||
String text = field.getText();
|
||||
if(!text.isEmpty()){
|
||||
confirmed.get(text);
|
||||
hide();
|
||||
}
|
||||
});
|
||||
keyDown(KeyCode.ESCAPE, this::hide);
|
||||
keyDown(KeyCode.BACK, this::hide);
|
||||
show();
|
||||
Core.scene.setKeyboardFocus(field);
|
||||
field.setCursorPosition(def.length());
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user