Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In an Entry the KeyUp and KeyDown events do not fire for some keys on the numeric pad #1325

Closed
SMerrony opened this issue Sep 19, 2020 · 1 comment
Assignees
Labels
Hacktoberfest Issues that count towards Hacktoberfest scores.

Comments

@SMerrony
Copy link

Describe the bug:

In an Entry the KeyUp and KeyDown events do not fire for some keys on the numeric pad.

To Reproduce:

Steps to reproduce the behaviour:

  1. Run the code below which is a slightly modified version of keypress-on-entry from the Fyne tutorial
  2. Hit 1 on the keypad - it shows in the widget, but the KeyUp() and KeyDown() events do not occur
  3. Hit (forward) slash on the keypad - it shows in the widget and both event occur as expected

Example code:

package main

import (
	"fmt"

	"fyne.io/fyne"
	"fyne.io/fyne/app"
	"fyne.io/fyne/widget"
)

type enterEntry struct {
	widget.Entry
}

func (e *enterEntry) onEnter() {
	fmt.Println(e.Entry.Text)
	e.Entry.SetText("")
}

func newEnterEntry() *enterEntry {
	entry := &enterEntry{}
	entry.ExtendBaseWidget(entry)
	return entry
}

func (e *enterEntry) KeyDown(key *fyne.KeyEvent) {
	switch key.Name {
	case fyne.KeyReturn:
		e.onEnter()
	default:
		e.Entry.KeyDown(key)
		fmt.Printf("Key %v pressed\n", key.Name)
	}
}

func (e *enterEntry) KeyUp(key *fyne.KeyEvent) {
	fmt.Printf("Key %v released\n", key.Name)
}

func main() {
	a := app.New()
	w := a.NewWindow("Messenger")

	entry := newEnterEntry()

	w.SetContent(entry)
	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: Linux
  • Version: Mint LMDE 4 Debbie
  • Go version: 1.14.4
  • Fyne version: 1.3.3 (? installed via go get last week)
@andydotxyz andydotxyz self-assigned this Sep 21, 2020
@andydotxyz andydotxyz added the Hacktoberfest Issues that count towards Hacktoberfest scores. label Oct 2, 2020
andydotxyz added a commit that referenced this issue Oct 14, 2020
@andydotxyz
Copy link
Member

Fix is on develop for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Issues that count towards Hacktoberfest scores.
Projects
None yet
Development

No branches or pull requests

2 participants