andlabs / andlabs/ui

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

オープン
#307 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
8.4k
フォーク
639
PR マージ指標
30日以内にマージされた PR はありません

説明

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)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。