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

Strange behavior table.Widget #5538

Closed
2 tasks done
jojosboomstick opened this issue Feb 18, 2025 · 5 comments
Closed
2 tasks done

Strange behavior table.Widget #5538

jojosboomstick opened this issue Feb 18, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@jojosboomstick
Copy link

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

Run fyne_demo. Go to collection -> table. Scroll down a bit. Select a cell. And now we have lost focus on the selected cell. Or run example.

Image

How to reproduce

Run fyne_demo. Go to collection -> table. Scroll down a bit. Select a cell. And now we have lost focus on the selected cell. Or run example.

Screenshots

No response

Example code

package main

import (
	"fmt"

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

func createData(height, width int) [][]string {
	data := make([][]string, height)

	for i := 0; i < height; i++ {
		data[i] = make([]string, width)
	}

	count := 1
	for i := 0; i < height; i++ {
		for j := 0; j < width; j++ {
			data[i][j] = fmt.Sprintf("%d", count)
			count++
		}
	}
	return data
}

func main() {
	myApp := app.New()
	myWindow := myApp.NewWindow("Table Widget")
	data := createData(100, 3)

	list := widget.NewTableWithHeaders(
		func() (int, int) {
			return len(data), len(data[0])
		},
		func() fyne.CanvasObject {
			return widget.NewLabel("wide content")
		},
		func(i widget.TableCellID, o fyne.CanvasObject) {
			o.(*widget.Label).SetText(data[i.Row][i.Col])
		})

	myWindow.SetContent(list)
	myWindow.ShowAndRun()
}

Fyne version

2.5.4

Go compiler version

1.23.3

Operating system and version

Windows 10

Additional Information

No response

@jojosboomstick jojosboomstick added the unverified A bug that has been reported but not verified label Feb 18, 2025
@andydotxyz
Copy link
Member

I don't understand - the focus (blue rectangle) seems to remain correctly in the video uploaded.

@jojosboomstick
Copy link
Author

I don't understand - the focus (blue rectangle) seems to remain correctly in the video uploaded.

I'm sorry. Perhaps I didn't express myself correctly. I mean that when the program is first launched, we go down the table and click on cell (112), but the visible area of ​​the grid moves to the very top and we need to scroll again to the selected cell. The second click already works fine.

@andydotxyz
Copy link
Member

Thank you, that makes sense. I wonder if it relates to a similar bug in the Tree widget that was fixed a while back #5478 ?

@jojosboomstick
Copy link
Author

jojosboomstick commented Feb 19, 2025

Thank you, that makes sense. I wonder if it relates to a similar bug in the Tree widget that was fixed a while back #5478 ?

Yep, the behavior is very similar. I tested widget.Tree with version 2.5.3 and 2.5.4

@andydotxyz
Copy link
Member

This is now fixed on develop ready for v2.6.0 thanks to @NicolasPerrenoud

@andydotxyz andydotxyz added this to the "F" release, Early 2025 milestone Feb 26, 2025
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Feb 26, 2025
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

2 participants