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

[BUG] VBox + Wrapping = Large Vertical Gap #1565

Closed
AlbinoGeek opened this issue Nov 17, 2020 · 8 comments
Closed

[BUG] VBox + Wrapping = Large Vertical Gap #1565

AlbinoGeek opened this issue Nov 17, 2020 · 8 comments
Labels
question A question has been asked

Comments

@AlbinoGeek
Copy link
Contributor

Summary

Creating a VBox that contains a Label with wrapped text, results in the VBox taking on the minimum height as if the text were not wrapped, resulting in a large blank space shown below it. This happens inside a window, modal, or dialog all the same.

Code

func (w *windowSettings) openLogin() {
	user := widget.NewEntry()
	pass := widget.NewPasswordEntry()

	warning := widget.NewLabel("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.")
	warning.Wrapping = fyne.TextWrapWord
	// tried resizing the warning itself, and the space cannot be removed

	vbox := widget.NewVBox(
		warning,
		widget.NewForm(
			widget.NewFormItem("Email", user),
			widget.NewFormItem("Password", pass),
		),
	)
	// tried to resize it here, and the space cannot be removed
	
	dlg := dialog.NewCustomConfirm("Login to sc2replaystats", "Login", "Cancel", vbox, func(ok bool) {
		if ok {
		}
	}, w)

	// if we resize it any earlier, the vertical space cannot be removed
	vbox.Resize(fyne.NewSize(999, 300)) // only the height is respected, not the width!

	// the dialog also needs to be resized now as a result
	// only resizing the dialog does not work, the vbox (due to Label) forces height otherwise
	dlg.Resize(fyne.NewSize(420, 300)) // both values respected here
	dlg.Show()
}

Result

image

@andydotxyz
Copy link
Member

What space are you referring to? The image provided seems correct to me

@andydotxyz andydotxyz added the question A question has been asked label Nov 17, 2020
@andydotxyz
Copy link
Member

Remember, resizing a widget that is contained within a parent layout will do nothing, as the container is controlling the size of the child widgets.

@andydotxyz
Copy link
Member

Perhaps I misunderstood - "results in the VBox taking on the minimum height as if the text were not wrapped" - I imagined you were saying that the content were not tall enough.
Can you please remove all the Resizes and re-post the code with a descrition of what is not correct.

@andydotxyz
Copy link
Member

Update

I cannot replicate this in the content of a window, which was listed as one of the ways it is broken above.

@AlbinoGeek
Copy link
Contributor Author

Without the resizes, the result is the screen-shot -- which is what I was trying to show (and didn't explain clearly.)

I have stopped using wrap across the application, I will have to try and see again if this happens in a window.

If not, that would make this a Dialog/Modal issue.

@andydotxyz
Copy link
Member

Once you have investigated can you please post the minimal code to replicate the issue.
It is not clear how the code above would be used, or which lines should be removed as well.
Anything that makes it easier for us to see the problem makes it easier to resolve ;)

@AlbinoGeek
Copy link
Contributor Author

#1570 may well get to the root of this bug -- but in the off chance these are actually two different bugs, I won't close this yet. I have included full reproduction code in that post, and will work on paring down the issue to reply here specifically to this issue.

@andydotxyz
Copy link
Member

I can no longer replicate this on develop, we re-wrote some text handling code which probably fixed it, so closing.

@andydotxyz andydotxyz added this to the Aberlour (2.1) milestone Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question has been asked
Projects
None yet
Development

No branches or pull requests

2 participants