Fyne: SetOnTypedKey() for Entry

Created on 4 Nov 2019  路  4Comments  路  Source: fyne-io/fyne

Is your feature request related to a problem? Please describe.
I would like to SetOnTypedKey() for Entry to do specific action when some entry is Focused.

Is it possible to construct a solution with the existing API?
I don't know

Describe the solution you'd like
I can do SetOnTypedKey() for canvas:
c.window.Canvas().SetOnTypedKey(c.typedKey)
Possible variant for entries:

entry.SetOnTypedKey(c.typedKey)
newMultiLineEntry.SetOnTypedKey(c.typedKey)
newPasswordEntry.SetOnTypedKey(c.typedKey)

example of Key Events handler:

func (c *someType) typedKey(ev *fyne.KeyEvent) {
    if ev.Name == fyne.KeyReturn {
        entry.SetText("")
    } 
}

Most helpful comment

There is some really helpful code in #537 which provides this functionality in our upcoming 1.2 release (ready for testing on develop branch).

All 4 comments

We are trying to avoid exposing too many details or customisations in the standard widgets. Would extending the entry widget and adding the key handling which falls back to the default be a possibility perhaps?

I think yes, thank you for considering my issue.

Thanks. I would provide demo code, but we are improving this area for the next release...
Feel free to stop by our Slack chat room or await our release in 3 weeks.

There is some really helpful code in #537 which provides this functionality in our upcoming 1.2 release (ready for testing on develop branch).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andydotxyz picture andydotxyz  路  3Comments

HeyDon-Lee picture HeyDon-Lee  路  9Comments

Geo25rey picture Geo25rey  路  7Comments

andydotxyz picture andydotxyz  路  7Comments

gazhayes picture gazhayes  路  8Comments