Make Catalog browsers focusable with shortcuts

- Category and scenario list views can now be focused with
  ctrl+a/ctrl+s.
- Bind all keys with ctrl modifier
- Add "shortcut" concept to views which currently hooks to
  hot keys.
- In a catalog app by using a "shortcut" then takes the key
  event as a hot key, as it consumes resulting behaviour
  is to focus.
- Move view initInternal away from constructor call to
  require user to call init() which is not in a
  View interface
- Relates #826
This commit is contained in:
Janne Valkealahti
2023-11-12 16:43:11 +00:00
parent a9b1675595
commit 2d29050c34
10 changed files with 53 additions and 7 deletions

View File

@@ -38,6 +38,7 @@ class TerminalUiSnippets {
void sample() {
TerminalUI ui = builder.build();
BoxView view = new BoxView();
ui.configure(view);
view.setDrawFunction((screen, rect) -> {
screen.writerBuilder()
.build()
@@ -59,6 +60,7 @@ class TerminalUiSnippets {
void sample() {
TerminalUI ui = new TerminalUI(terminal);
BoxView view = new BoxView();
ui.configure(view);
ui.setRoot(view, true);
EventLoop eventLoop = ui.getEventLoop();
eventLoop.keyEvents()