Closed
Description
Checklist
- I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
- This issue only relates to a single bug. I will open new issues for any other problems.
Describe the bug
When making a widget.NewTreeWithData with the binding to a tree fyne sometimes doesnt render items above the selected one except for one above. See Video.
How to reproduce
- Run Example Code
- Select the 2nd item, then the 3rd, then the 4th
- If the bug didnt trigger, close the application and do 2. again (See Video)
Screenshots
minex.mp4
Example code
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("BUG DEMO")
w.Resize(fyne.NewSize(800, 600))
w.SetContent(makeMain(a, w))
w.Show()
a.Run()
}
func makeMain(a fyne.App, w fyne.Window) fyne.CanvasObject {
tree := binding.NewStringTree()
treewg := widget.NewTreeWithData(
tree,
func(_ bool) fyne.CanvasObject {
return widget.NewLabel("example str")
},
func(data binding.DataItem, _ bool, obj fyne.CanvasObject) {
l := obj.(*widget.Label)
d, err := data.(binding.String).Get()
if err != nil {
panic(err)
}
l.SetText(d)
},
)
for _, str := range []string{"aaa", "bbb", "ccc", "ddd", "eee"} {
tree.Append(binding.DataTreeRootID, str, str+str)
}
return container.NewPadded(treewg)
}
Fyne version
2.4.1
Go compiler version
1.21.3
Operating system and version
linux/amd64
Additional Information
Does NOT happen with widget.NewListWithData
Activity