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

Dialog.Resize() has no effect if called before Dialog.Show() #1863

Closed
jens1205 opened this issue Jan 25, 2021 · 2 comments
Closed

Dialog.Resize() has no effect if called before Dialog.Show() #1863

jens1205 opened this issue Jan 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@jens1205
Copy link

Describe the bug:

Dialog.Resize() only has an effect on the created dialog if it is called after Dialog.Show(). This is not consistent with window.Resize() which can be used before or after Show()

To Reproduce:

Screenshots:

Example code:

package main

import (
	"log"

	"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("testwindow")

	button := widget.NewButton("dialog", func() {
		username := widget.NewEntry()
		password := widget.NewPasswordEntry()

		items := []*widget.FormItem{
			widget.NewFormItem("username", username),
			widget.NewFormItem("password", password),
		}

		form := dialog.NewForm("mydialog", "OK", "Cancel", items,
			func(ok bool) {
				if !ok {
					return
				}
				log.Println(username.Text, username.Password)
			}, w)

		// no effect
		form.Resize(fyne.NewSize(1000, 200))

		form.Show()

		// would work
		// form.Resize(fyne.NewSize(1000, 200))

	})

	w.SetContent(container.NewMax(button))

	// has an effect
	w.Resize(fyne.NewSize(1900, 1080))

	w.Show()

	// would also work
	// w.Resize(fyne.NewSize(1900, 1080))

	a.Run()

}

-->

Device (please complete the following information):

  • OS: Linux
  • Version: Ubuntu 20.04.1 LTS
  • Go version: 1.15.7 linux/amd64
  • Fyne version: v2.0.0
@jens1205 jens1205 added the bug Something isn't working label Jan 25, 2021
@AlbinoGeek
Copy link
Contributor

Related to (but not a duplicate of): #1570 , #1565

Also possibly #1692 and #1382

@andydotxyz
Copy link
Member

The fix for this is now on the develop branch

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

4 participants