1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Tabbing to widgets properly sets the IsFocused property. Closes #467

This commit is contained in:
Chris Cummer 2019-05-25 15:19:18 -07:00
parent 7a93824027
commit 042f602ddb
2 changed files with 5 additions and 1 deletions

View File

@ -10,7 +10,7 @@ import (
func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar(" ", widget.Refresh, "Refresh widget")
widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget")
widget.SetKeyboardChar("j", widget.displayNext, "Select next item")
widget.SetKeyboardChar("k", widget.displayPrev, "Select previous item")
widget.SetKeyboardChar(" ", widget.toggleChecked, "Toggle checkmark")

View File

@ -79,6 +79,8 @@ func (tracker *FocusTracker) Next() {
tracker.blur(tracker.Idx)
tracker.increment()
tracker.focus(tracker.Idx)
tracker.IsFocused = true
}
// None removes focus from the currently-focused widget.
@ -100,6 +102,8 @@ func (tracker *FocusTracker) Prev() {
tracker.blur(tracker.Idx)
tracker.decrement()
tracker.focus(tracker.Idx)
tracker.IsFocused = true
}
func (tracker *FocusTracker) Refocus() {