Updated Keyboard focus (markdown)

Jakub Sobon 2020-11-29 23:27:17 -05:00
parent 1657bc6e70
commit bb7e3ca7f0
1 changed files with 17 additions and 1 deletions

@ -41,3 +41,19 @@ The **container.KeyFocusPrevious** option is used to configure a key that will m
Even if a key is configured to move the focus, it still gets delivered as a keyboard event to widgets that subscribe to keyboard events. See the [[Widget API|Widget-API]] for details about subscribing widgets to keyboard events.
A widget that subscribed with **KeyScopeGlobal** always get's the key press event. A widget that subscribed with **KeyScopeFocused** only gets the key press event if it is focused after the focus change.
### Using keyboard events within focus groups
In addition to the **container.KeyFocusNext** and **container.KeyFocusPrevious** options that allow moving keyboard focus through all leaf containers, the user can also assign containers into separate focus groups.
#### [container.KeyFocusGroup](https://godoc.org/github.com/mum4k/termdash/container#KeyFocusGroup):
The **container.KeyFocusGroup** assigns a container into a focus group identified by a number.
#### [container.KeyFocusGroupNext](https://godoc.org/github.com/mum4k/termdash/container#KeyFocusGroupNext):
The **container.KeyFocusGroupNext** is like the **container.KeyFocusNext** option, but the keys configured using this option only move the keyboard focus within a single focus group. The key only takes effect if the currently focused container is a part of the same focus group.
#### [container.KeyFocusGroupPrevious](https://godoc.org/github.com/mum4k/termdash/container#KeyFocusGroupPrevious):
The **container.KeyFocusGroupPrevious** is like the **container.KeyFocusPrevious** option, but the keys configured using this option only move the keyboard focus within a single focus group. The key only takes effect if the currently focused container is a part of the same focus group.