fork of github.com/sqweek/dialog + github.com/Wieku/dialog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
forest cbfd90d16f move module to git.sequentialread.com/forest/go-dialog so I can use it 4 months ago
cocoa cocoa: fix case in include directive 5 years ago
example move module to git.sequentialread.com/forest/go-dialog so I can use it 4 months ago
.golangci.yml cleanup: better adhere to golang conventions 6 years ago
LICENSE Add ISC license. 7 years ago
README.md win32: document Load/Save effect on working directory 3 years ago
dlgs.go Add loading multiple files to Windows and Linux 2 years ago
dlgs_darwin.go move module to git.sequentialread.com/forest/go-dialog so I can use it 4 months ago
dlgs_linux.go Add loading multiple files to Windows and Linux 2 years ago
dlgs_windows.go Use SIGDN_FILESYSPATH to get proper paths from search 9 months ago
go.mod move module to git.sequentialread.com/forest/go-dialog so I can use it 4 months ago
go.sum Fix folder selector freezing if COM is initialized in multithreaded mode 2 years ago
util.go dialog: simple cross-platform dialog API 9 years ago

README.md

dialog

Simple cross-platform dialog API for go-lang

examples

ok := dialog.Message("%s", "Do you want to continue?").Title("Are you sure?").YesNo()

Creates a dialog box titled "Are you sure?", containing the message "Do you want to continue?", a "Yes" button and a "No" button. Returns true iff the dialog could be displayed and the user pressed the "Yes" button.

filename, err := dialog.File().Filter("Mp3 audio file", "mp3").Load()

Creates a file selection dialog allowing the user to select a .mp3 file. The absolute path of the file is returned, unless an error is encountered or the user cancels/closes the dialog. In the latter case, filename will be the empty string and err will equal dialog.Cancelled.

filename, err := dialog.File().Filter("XML files", "xml").Title("Export to XML").Save()

Asks the user for a filename to write data into. If the user selects a file which already exists, an additional dialog is spawned to confirm they want to overwrite the existing file.

directory, err := dialog.Directory().Title("Load images").Browse()

Asks the user for a directory.

platform details

  • OSX: uses Cocoa's NSAlert/NSSavePanel/NSOpenPanel classes
  • Win32: uses MessageBox/GetOpenFileName/GetSaveFileName (via package github.com/TheTitanrain/w32)
  • Linux: uses Gtk's MessageDialog/FileChooserDialog (via cgo; requires gtk3 development packages)

build

go mod download
go build

bugs

On windows, the Load() and Save() calls change the working directory for the whole process while the dialog is open (after which it reset). This is an apparently unavoidable side effect of the underlying W32API; see #63 for more details.