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

Scrolled List bad redraw when window is maximized #3013

Closed
matwachich opened this issue May 29, 2022 · 5 comments
Closed

Scrolled List bad redraw when window is maximized #3013

matwachich opened this issue May 29, 2022 · 5 comments
Labels
bug Something isn't working OS:Windows Tickets affecting only Microsoft Windows

Comments

@matwachich
Copy link
Contributor

To Reproduce:

  1. Run the code
  2. Scroll the list a little bit down
  3. Maximize the window

Example code:

package main

import (
	"fmt"
	"time"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/layout"
	"fyne.io/fyne/v2/widget"
)

type Person struct {
	ID           int
	Nom, Prenom  string
	DOB          time.Time
	LastActivity time.Time
}

func main() {
	a := app.New()
	w := a.NewWindow("Test")

	data := make([]Person, 10)
	for i := 0; i < 10; i++ {
		data[i].ID = i
		data[i].Nom = "AAAAAAAA"
		data[i].Prenom = "Aaaaaaaa"
		data[i].DOB = time.Now()
		data[i].DOB = time.Now()
	}

	lst := widget.NewList(
		func() int {
			return len(data)
		},
		func() fyne.CanvasObject {
			co := container.NewHBox(
				widget.NewLabel("id"),
				widget.NewLabel("nom prenom"),
				widget.NewLabel("dob\r\nage"),
				layout.NewSpacer(),
				widget.NewLabel("last activity:\r\ndate"),
			)
			co.Objects[1].(*widget.Label).TextStyle.Bold = true
			return co
		},
		func(i widget.ListItemID, co fyne.CanvasObject) {
			co.(*fyne.Container).Objects[0].(*widget.Label).SetText(fmt.Sprintf("%02d", data[i].ID))
			co.(*fyne.Container).Objects[1].(*widget.Label).SetText(fmt.Sprintf("%s %s", data[i].Nom, data[i].Prenom))
			co.(*fyne.Container).Objects[2].(*widget.Label).SetText(fmt.Sprintf("%s\r\n(00 years old)", data[i].DOB.Format("02/01/2006")))
			co.(*fyne.Container).Objects[4].(*widget.Label).SetText(fmt.Sprintf("Last activity:\r\n%s", data[i].LastActivity.Format("02/01/2006 à 15h04m05s")))
		},
	)

	w.SetContent(container.NewMax(lst))

	w.Resize(fyne.NewSize(800, 400))
	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: 1.18.2
  • Fyne version: 2.1.4
@matwachich matwachich added the unverified A bug that has been reported but not verified label May 29, 2022
@Jacalz
Copy link
Member

Jacalz commented May 31, 2022

Would you mind checking if you can replicate this issue on the develop branch? I think this might have been solved by #3012. You should be able to just update your local module using go get fyne.io/fyne/v2@develop && go mod tidy.

@cmitsakis
Copy link
Contributor

I can confirm this bug.

The top elements (that were hidden because of scrolling) do not appear when I maximize. They are replaced by empty space. But when I click at any element they appear. This happens even on develop.

This doesn't happen if you increase the number of elements enough so that the maximized window can keep scroll at the same position.

If you can't replicate, you can change the number of elements (or the window resolution) so there is scroll when the window is small and there is no scroll when maximized.

@cmitsakis
Copy link
Contributor

this bug happens in Table too

@andydotxyz andydotxyz added OS:Windows Tickets affecting only Microsoft Windows bug Something isn't working and removed unverified A bug that has been reported but not verified labels Jun 3, 2022
@andydotxyz
Copy link
Member

Argh I hate that Windows manages to make maximise and minimise somehow different on their OS than all others

@andydotxyz
Copy link
Member

On develop for testing, thanks @cmitsakis

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

Successfully merging a pull request may close this issue.

4 participants