From 247c75093274edf3327d447c9601b5740d305c82 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 6 Mar 2021 14:16:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Handle=20key=20events=20globally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c1382a0..5be9ea4 100644 --- a/main.go +++ b/main.go @@ -95,10 +95,10 @@ func main() { return len(currentEntries) }, func() fyne.CanvasObject { - tn := canvas.NewText("Dummy", theme.TextColor()) + tn := canvas.NewText("Dummy", theme.ForegroundColor()) tn.TextStyle.Bold = true - td := canvas.NewText("Dummy", theme.TextColor()) + td := canvas.NewText("Dummy", theme.ForegroundColor()) td.TextSize = theme.TextSize() * 8 / 10 return container.NewHBox( @@ -124,6 +124,7 @@ func main() { l.OnSelected = func(id widget.ListItemID) { currentId = id + w.Canvas().Focus(e) } e.OnChanged = func(s string) { @@ -184,6 +185,9 @@ func main() { } return false } + w.Canvas().SetOnTypedKey(func(event *fyne.KeyEvent) { + e.onKeyTyped(event) + }) w.Canvas().Focus(e)