allow Esc key to clear and unfocus search fields

This commit is contained in:
Drew Weymouth
2023-11-05 12:10:15 -08:00
parent 91c6addd89
commit 9f63822806
+9
View File
@@ -37,6 +37,15 @@ func NewSearchEntry() *SearchEntry {
return sf
}
func (s *SearchEntry) TypedKey(e *fyne.KeyEvent) {
if e.Name == fyne.KeyEscape {
s.SetText("")
fyne.CurrentApp().Driver().CanvasForObject(s).Unfocus()
return
}
s.Entry.TypedKey(e)
}
func (s *SearchEntry) Refresh() {
s.updateActionButton()
s.Entry.Refresh()