andlabs / andlabs/ui

ui.Entry event OnChanged doesn't fire for its SetText function

Aperta
#307 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
8.4k
Fork
639
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,
for me, the ui.Entry event OnChanged doesn't fire for its SetText function. My setup is like this:

```go
myInput = ui.NewEntry()
myOpenButton.OnClicked(func(_ *ui.Button) {
file := ui.OpenFile(window)
myInput.SetText(file)
})
myInput.OnChanged(func(_ *ui.Entry) {
fmt.Println(myInput.Text())
})
```
When I enter something manually in the entry field, the event gets fired just fine. But it doesn't fire for `myInput.SetText(file)`. Of course, I can easily work around that, just noticing. :)
Currently, it looks like this:

```go
myInputOnChanged := func(_ *ui.Entry) {
fmt.Println(myInput.Text())
}
myOpenButton.OnClicked(func(_ *ui.Button) {
file := ui.OpenFile(window)
myInput.SetText(file)
myInputOnChanged(nil)
})
myInput.OnChanged(myInputOnChanged)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.