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

Changing TabItem Text #870

Closed
s77rt opened this issue Apr 16, 2020 · 6 comments
Closed

Changing TabItem Text #870

s77rt opened this issue Apr 16, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@s77rt
Copy link
Contributor

s77rt commented Apr 16, 2020

Hi,
Can we change the text of an existing TabItem?

@andydotxyz
Copy link
Member

It should be possible to change the value in TabItem.Text and then call TabContainer.Refresh() - if that is not refreshing you have found a bug.

@andydotxyz andydotxyz added the bug Something isn't working label Apr 16, 2020
@s77rt
Copy link
Contributor Author

s77rt commented Apr 16, 2020

yes, seems as a bug, any progress on this?

@Jacalz
Copy link
Member

Jacalz commented Apr 16, 2020

@s77rt Would you mind adding additional information to the issue like operating system, fyne version and go version and possibly a small code snippet example on what exactly you are doing? It makes it much easier to help you out :)

@s77rt
Copy link
Contributor Author

s77rt commented Apr 16, 2020

@Jacalz
OS: Linux
fyne: tested on 1.2.2, 1.2.3, 1.2.4 (probably other versions too)
go: 1.13

Code example:

package main

import (
	"fyne.io/fyne"
	"fyne.io/fyne/app"
	"fyne.io/fyne/widget"
)

func main() {
	app := app.New()
	w := app.NewWindow("Tabs?")
	var tabs *widget.TabContainer
	var tab1, tab2 *widget.TabItem
	tab1 = widget.NewTabItem("Tab 1 (Change me)",
		widget.NewVBox(
			widget.NewButton("Change Tab1 Text", func() {
				tab1.Text = "Tab 1 (Changed)"
				tabs.Refresh()
			}),
			widget.NewButton("Change Tab2 Text", func() {
				tab2.Text = "Tab 2 (Changed)"
				tabs.Refresh()
			}),
		),
	)
	tab2 = widget.NewTabItem("Tab 2 (Change me)", widget.NewLabel("Just another tab"))
	tabs = widget.NewTabContainer(
		tab1,
		tab2,
	)
	tabs.SetTabLocation(widget.TabLocationLeading)
	w.SetContent(tabs)
	w.Resize(fyne.Size{200, 150})
	w.ShowAndRun()
}

the purpose is to change the text of the tabs 1 and 2.
click on the buttons, you should expect a change on the text of the tabs, but nothing happen

@andydotxyz andydotxyz self-assigned this Apr 17, 2020
@andydotxyz
Copy link
Member

I have a potential fix locally, just tidying up and testing.

@s77rt
Copy link
Contributor Author

s77rt commented Apr 19, 2020

just tested, works as expected :)

@s77rt s77rt closed this as completed Apr 19, 2020
andydotxyz added a commit that referenced this issue Apr 20, 2020
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

3 participants