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

DocTabs.OnUnselected not called #4985

Open
2 tasks done
matwachich opened this issue Jul 3, 2024 · 0 comments
Open
2 tasks done

DocTabs.OnUnselected not called #4985

matwachich opened this issue Jul 3, 2024 · 0 comments
Labels
unverified A bug that has been reported but not verified

Comments

@matwachich
Copy link
Contributor

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

Closing a docTabItem will not call OnSelected on the next tabItem if this one is located after the closed item.

How to reproduce

Run the provided code, open 2 tabs (tab 1, tab 2)
Selected tab 1, then close it
Tab 2 selected should be called, but it is not.

Screenshots

No response

Example code

package main

import (
	"fmt"

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

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

	var i int
	docs := container.NewDocTabs()
	docs.CreateTab = func() *container.TabItem {
		i++
		return container.NewTabItem(fmt.Sprintf("tab %03d", i), widget.NewLabel("Tab content"))
	}
	docs.OnSelected = func(ti *container.TabItem) {
		fmt.Println("Tab", ti.Text, "selected")
	}
	docs.OnUnselected = func(ti *container.TabItem) {
		fmt.Println("Tab", ti.Text, "unselected")
	}

	w.SetContent(docs)
	w.ShowAndRun()
}

Fyne version

2.4.5

Go compiler version

1.20.14

Operating system and version

Windows 10

Additional Information

Another idea to be discussed: shouldn't be OnUnselected called when closing a tabItem?

@matwachich matwachich added the unverified A bug that has been reported but not verified label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

1 participant