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

NewTreeWithData Rendering Issue #4346

Closed
2 tasks done
BieHDC opened this issue Oct 27, 2023 · 8 comments
Closed
2 tasks done

NewTreeWithData Rendering Issue #4346

BieHDC opened this issue Oct 27, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@BieHDC
Copy link
Contributor

BieHDC commented Oct 27, 2023

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

  1. Run Example Code
  2. Select the 2nd item, then the 3rd, then the 4th
  3. 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

@BieHDC BieHDC added the unverified A bug that has been reported but not verified label Oct 27, 2023
@dozn
Copy link

dozn commented Oct 30, 2023

The example code on https://developer.fyne.io/collection/tree exhibits the same behaviour (although it's worth noting the container.NewPadded() in the OP makes the upper portion disappear completely sometimes as well).

@billytoe
Copy link

go 1.21.5

fyne.io/fyne/v2 v2.4.3

macOS 14.0

Also, when placing two tree controls on the interface, one of them may work properly while the other sometimes encounters this bug and sometimes doesn't. This bug usually appears when a new execution interface is launched.

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Apr 2, 2024
@andydotxyz andydotxyz added this to the D fixes (v2.4.x) milestone Apr 2, 2024
@ErikKalkoken
Copy link
Contributor

ErikKalkoken commented May 31, 2024

Can confirm this bug is occurring on both Windows and Linux:

OS Fyne Go
Windows 10 22H2 Fyne 2.4.5 Go 1.22.1
Ubuntu 22.04.4 LTS Fyne 2.4.5 Go 1.22.1

The bug happens regularly around ever 5 times I start my app. I was planning to use this widget, so keeping my fingers crossed for a fix soon.

@LidiYuan
Copy link

I also found this issue on unbuntu18, and the triggering frequency is still very high. Relevant records。 I used version 2.5 for the relevant records. Detailed description reference:
#5082
When can this be resolved, or is there any way to avoid it

@ErikKalkoken
Copy link
Contributor

I also found this issue on unbuntu18, and the triggering frequency is still very high. Relevant records。 I used version 2.5 for the relevant records. Detailed description reference: #5082 When can this be resolved, or is there any way to avoid it

The no data variant (widget.NewTree()) works fine, so one way to avoid it is to use that variant until the bug is fixed. At least that is what I did in my apps.

@williambrode
Copy link
Contributor

This was fixed with this PR: #5096

@williambrode
Copy link
Contributor

This issue is a duplicate of #5093 - I'm sorry I missed it when opening a new issue.

@williambrode
Copy link
Contributor

If you need the fix right away (as I did) - you can do:
go get fyne.io/fyne/v2@3689a40c581fa9935cbd2cade9beb4ba5726cd78

Though, that could carry some less-tested changes that have recently gone in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants