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
Setting TextWrapWord crashes the application #2961
Comments
Thanks, will look into this. |
Oh I might add that I was following along the following tutorial as an intro to Fyne: https://youtu.be/m_ZyPDARmsI |
I cannot replicate this with fyne on |
I replicated the issue on my desktop with fyne version 2.2.0. I haven't done anything else since I put the project aside. Full code example which gives the error: package main
import (
"encoding/json"
"io/ioutil"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
type MovieResults struct {
Results []Movie `json:"results"`
}
type Movie struct {
Title string `json:"title"`
Overview string `json:"overview"`
}
func main() {
movieResults, err := LoadMovies()
if err != nil {
panic(err)
}
a := app.New()
w := a.NewWindow("Movie View")
// w.Resize(fyne.NewSize(700, 600))
w.Resize(fyne.NewSize(500, 500))
listView := widget.NewList(func() int {
return len(movieResults.Results)
}, func() fyne.CanvasObject {
return widget.NewLabel("template")
}, func(id widget.ListItemID, object fyne.CanvasObject) {
object.(*widget.Label).SetText(movieResults.Results[id].Title)
})
contentText := widget.NewLabel("Please select a movie ")
contentText.Wrapping = fyne.TextWrapWord
listView.OnSelected = func(id widget.ListItemID) {
contentText.SetText(movieResults.Results[id].Overview)
}
split := container.NewHSplit(
listView,
contentText,
//this will fill in the blank
// container.NewMax(contentText),
)
split.Offset = 0.2
w.SetContent(split)
w.ShowAndRun()
}
func LoadMovies() (MovieResults, error) {
data, err := ioutil.ReadFile("./data.json")
if err != nil {
return MovieResults{}, err
}
var movieResults MovieResults
err = json.Unmarshal(data, &movieResults)
if err != nil {
return MovieResults{}, err
}
return movieResults, nil
} |
This won't load data without |
{ |
Thanks. It looks like this and #3003 are the same issue |
Closing as a duplicate as it is easier to replicate with the #3003 issue |
Describe the bug:
When I set the label wrapping to TextWrapWord my application crashes on startup
To Reproduce:
Steps to reproduce the behaviour:
Example code:
Error Message
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: