Skip to content

Commit

Permalink
Merge pull request #1352 from PucklaMotzer09/fix_file_dialog_resize_b…
Browse files Browse the repository at this point in the history
…efore_show

Fix calling Resize before Show in file dialog
  • Loading branch information
andydotxyz committed Oct 1, 2020
2 parents f6c3183 + 820f39a commit a67eb2f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dialog/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type FileDialog struct {
parent fyne.Window
dialog *fileDialog
dismissText string
desiredSize *fyne.Size
}

// Declare conformity to Dialog interface
Expand Down Expand Up @@ -312,10 +313,18 @@ func (f *FileDialog) Show() {
return
}
f.dialog = showFile(f)
if f.desiredSize != nil {
f.Resize(*f.desiredSize)
f.desiredSize = nil
}
}

// Resize dialog, call this function after dialog show
func (f *FileDialog) Resize(size fyne.Size) {
if f.dialog == nil {
f.desiredSize = &size
return
}
maxSize := f.dialog.win.Size()
minSize := f.dialog.win.MinSize()
newWidth := size.Width
Expand Down

0 comments on commit a67eb2f

Please sign in to comment.