Git Product home page Git Product logo

dialog's Introduction

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/AllenDang/w32)
  • Linux: uses Gtk's MessageDialog/FileChooserDialog (via package github.com/mattn/gtk)

build

go mod download
go build

dialog's People

Contributors

sqweek avatar crazy-max avatar juliardi avatar patrickgh3 avatar meskio avatar schobers avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.