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

Form dialog with pre-filled text Entry widgets doesn't resize to allow for that text #5501

Open
2 tasks done
pneumaticdeath opened this issue Feb 5, 2025 · 3 comments
Open
2 tasks done
Labels
unverified A bug that has been reported but not verified

Comments

@pneumaticdeath
Copy link

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

When presenting a form witj text Entry widget(s) with even moderate amounts of text, the form presents fields that are much to small to be usable for anything other than a word or two.

How to reproduce

See attached code

  1. Push "Go" button
  2. Form unusably small

Screenshots

Image

Example code

package main

import (
	"fmt"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/widget"
)

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

	button := widget.NewButton("Go", func() {
		entry1 := widget.NewEntry()
		entry1.Text = "This is a little long"
		entry2 := widget.NewEntry()
		entry2.Text = "This is really very quite long, isn't it?"
		items := []*widget.FormItem{
			widget.NewFormItem("Foo", entry1),
			widget.NewFormItem("Bar", entry2)}
		dialog.ShowForm("Sample form", "Yes", "No", items, func(submitted bool) {
			if submitted {
				fmt.Println("Submitted")
			}
		}, w)
	})

	cont := container.NewCenter(button)

	w.SetContent(cont)
	w.Resize(fyne.NewSize(800,600))
	w.ShowAndRun()
}

Fyne version

2.5.3

Go compiler version

go1.23.4

Operating system and version

darwin/arm64 (Sequoia)

Additional Information

No response

@pneumaticdeath pneumaticdeath added the unverified A bug that has been reported but not verified label Feb 5, 2025
@andydotxyz
Copy link
Member

That is correct - because Entry is scrollable.

You can turn off the scrolling of the entry widgets - but bear in mind in that case that they will shrink when the text is smaller.

The solution here is probably to use the Dialog.Resize() before you show it. (dialog.NewForm() will return you a handle to manipulate that dialog before calling Show()).

@pneumaticdeath
Copy link
Author

Resizing the form dialog is what I ended up doing, but the default behavior is unusable on mobile. I don't really know what the right answer is.

@andydotxyz
Copy link
Member

Why does using "Resize" seem like the wrong answer? it's what you do with Windows already...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants