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

Extending Entry widget adds space below it, when inside a Form #3076

Closed
matwachich opened this issue Jun 16, 2022 · 4 comments · Fixed by #3184
Closed

Extending Entry widget adds space below it, when inside a Form #3076

matwachich opened this issue Jun 16, 2022 · 4 comments · Fixed by #3184
Labels
bug Something isn't working

Comments

@matwachich
Copy link
Contributor

Describe the bug:

When extending the Entry widget, there is some space

To Reproduce:

Just run the example code, and see the difference between the CustomEntry inside a Form and inside a VBox

Screenshots:

image

Example code:

package main

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

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

	content := container.NewGridWithColumns(2,
		widget.NewForm(
			widget.NewFormItem("Standard Entry 01", widget.NewEntry()),
			widget.NewFormItem("Custom Entry", NewCustomEntry()),
			widget.NewFormItem("Standard Entry 02", widget.NewEntry()),
		),
		container.NewVBox(
			widget.NewEntry(),
			NewCustomEntry(),
			widget.NewEntry(),
		),
	)
	content.Objects[0].(*widget.Form).OnSubmit = func() {
		println("Submit...")
	}

	w.SetContent(content)
	w.Resize(fyne.NewSize(800, 500))
	w.CenterOnScreen()
	w.ShowAndRun()
}

type CustomEntry struct {
	widget.Entry
}

func NewCustomEntry() *CustomEntry {
	ce := &CustomEntry{}
	ce.ExtendBaseWidget(ce)
	return ce
}

Device (please complete the following information):

  • OS: Windows 10
  • Version: 10.0.18363.2212
  • Go version: 1.18.2
  • Fyne version: 2.2.0
@matwachich matwachich added the unverified A bug that has been reported but not verified label Jun 16, 2022
@andydotxyz
Copy link
Member

I think this relates to the validation, perhaps the default setup is not proving a clean setup...
Thanks for opening, we should try and figure this out - though it may relate to #2964

@andydotxyz andydotxyz added this to the Fixes (v2.2.x) milestone Jun 20, 2022
@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Jun 20, 2022
@matwachich
Copy link
Contributor Author

matwachich commented Jul 14, 2022

Some new information: the bug seems to exist also for a standard SelectEntry (not extended widget) inside a Form
image

// build & return layout
	return container.New(&PercentColsLayout{Percents: []int{30, 70}},
		container.NewBorder(tab.toolbar, tab.author, nil, nil, tab.list),
		container.NewBorder(
			&widget.Form{Items: []*widget.FormItem{
				{Text: "Titre", Widget: tab.Titre},
				{Text: "Catégorie", Widget: tab.Categorie},
				{Text: "", Widget: tab.Public},
			}},
			nil, nil, nil,

@andydotxyz
Copy link
Member

Ah yes, this is helpful thanks

@matwachich
Copy link
Contributor Author

Some new information: setting a non nil Validator to a standard Entry gives the same effet.
So it is definitly related to Validation. It's like something says to the layout that a custom Entry is like an Entry with a Validator.

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

Successfully merging a pull request may close this issue.

2 participants