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
Tab buttons stop working after removing a tab #3050
Comments
The latest version of Fyne is v2.2.0. Can you please try with the new version and see if the issue still persists? |
I think it's root cause it here: https://github.com/fyne-io/fyne/blob/develop/container/apptabs.go#L341-L349. When you remove a tab, the index bind to the tab button is not updated. You can replace the codes like this, and it will work. @leprechaun33 item := r.appTabs.Items[i]
index := i // capture
button := &tabButton{
onTapped: func() { r.appTabs.SelectIndex(index) },
}
r.buttonCache[item] = button Do you have any ideas about how to fix it elegantly? @Jacalz |
Hmm. Nice catch @d4x1. The best fix would probably be to stop using indexes all together and find a better solution but I suspect that your fix might work as well. |
After reading the codes, a more convenient way to fix it is use |
Fix #3050, update onTapped hooker for tabButton
Thanks so much @d4x1, this is now on |
Describe the bug:
When removing a tab from AppTabs the tabs that are to the right of the removed tab cannot be selected with mouse clicks.
If there are tabs 1, 2, 3, 4 and tab 2 is removed then the tab buttons for 3 and 4 will not respond to mouse clicks. If tabs 5 and 6 are then added, the buttons for tabs 5 and 6 will still work like normal.
To Reproduce:
Steps to reproduce the behaviour:
Running the below code, go to File -> New Tab two or three times.
Then select a tab that is not the last tab and click the "Close Tab" button, after this the tab buttons of tabs to the right of the removed tab will not work.
If another tab is added then removed then the last tab will be selected.
Example code:
Device:
The text was updated successfully, but these errors were encountered: