Skip to content

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

Closed
@jens1205

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions