Skip to content

Commit

Permalink
fyne-ioGH-4595: add method to set view of filedialog
Browse files Browse the repository at this point in the history
  • Loading branch information
maruu committed Feb 1, 2024
1 parent 0ea6caa commit 3462929
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dialog/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type FileDialog struct {
startingLocation fyne.ListableURI
// this will be the initial filename in a FileDialog in save mode
initialFileName string
// this will be the initial view in a FileDialog
initialView ViewLayout
}

// Declare conformity to Dialog interface
Expand Down Expand Up @@ -774,6 +776,17 @@ func (f *FileDialog) SetFileName(fileName string) {
}
}

// SetView changes the default display view of the FileDialog
// This is normally called before the dialog is shown.
//
// Since: 2.5
func (f *FileDialog) SetView(v ViewLayout) {
f.initialView = v
if f.dialog != nil {
f.dialog.setView(v)
}
}

// NewFileOpen creates a file dialog allowing the user to choose a file to open.
// The callback function will run when the dialog closes. The URI will be nil
// when the user cancels or when nothing is selected.
Expand Down

0 comments on commit 3462929

Please sign in to comment.