Giter VIP home page Giter VIP logo

go-common-file-dialog's People

Contributors

harryjph avatar kettek avatar mjathecpa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-common-file-dialog's Issues

Specify HWND

Firstly, thanks for a superb project!
I've noticed that as the HWND isn't specified, it can sometime appear beneath my application window. How easy would it be to add a method to set the parent HWND? Perhaps as a property on cfd.DialogConfig? Cheers.

Cannot open a file chooser dialog from a 386 binary on 64bit Windows

I'm trying to create an small application providing a file chooser, and I saw an unexpected error only on 386 binary running on Windows 10 64bit.
An amd64 binary built from the same source running on Windows 10 64bit works as expected.
Should this error be tracked on this project? Or, should I report this to other place?

Thanks,

Steps to reproduce

  1. Prepare a golang development environment. I'm using go1.16.6 linux/amd64 on Ubuntu on WSL1 on Windows 10.

  2. Create testcase.go under a directory, as:

    package main
    
    import (
    	"github.com/harry1453/go-common-file-dialog/cfd"
    	"github.com/harry1453/go-common-file-dialog/cfdutil"
    	"log"
    )
    
    func main() {
    	result, err := cfdutil.ShowOpenFileDialog(cfd.DialogConfig{
    		Title: "Title",
    		Role:  "TestCaseRole",
    		FileFilters: []cfd.FileFilter{
    			{
    				DisplayName: "File",
    				Pattern:     "*.*",
    			},
    		},
    		SelectedFileFilterIndex: 0,
    		FileName:                "file",
    		DefaultExtension:        ".txt",
    	})
    	log.Fatal(err)
    	log.Fatal(result)
    }
    
  3. Start bash on Ubuntu on WSL1.

  4. Change working directory to the directory testcase.go placed at.

  5. Run gox -os="windows" . to build binaries.

  6. Then two binaries golang-testcase_windows_amd64.exe and golang-testcase_windows_386.exe are built.

  7. Start cmd.exe on Windows.

  8. Run golang-testcase_windows_amd64.exe on the command prompt. A file chooser dialog appears, so close it.

  9. Run golang-testcase_windows_386.exe on the command prompt.

Expected result

A file chooser dialog appears, same as golang-testcase_windows_amd64.exe.

Actual result

No dialog appears and an error:

C:\Users\piro>>C:\Users\piro\golang-testcase_windows_386.exe
Exception 0xc0000005 0x0 0x140d8b64 0x779cef90
PC=0x779cef90

syscall.Syscall(0x75d08a90, 0x2, 0x1222df0, 0x1, 0x11c06290, 0x0, 0x0, 0x0)
        /usr/local/go/src/runtime/syscall_windows.go:330 +0xbb
github.com/harry1453/go-common-file-dialog/cfd.(*iFileDialogVtbl).setFileTypes(0x75cc18b4, 0x1222df0, 0x11c04180, 0x1, 0x1, 0x1, 0x31d44c50)
        /home/piro/go/src/github.com/harry1453/go-common-file-dialog/cfd/vtblCommonFunc.go:51 +0x11e
github.com/harry1453/go-common-file-dialog/cfd.(*iFileOpenDialog).SetFileFilters(0x1222df0, 0x11c04180, 0x1, 0x1, 0x1222df0, 0x11c06201)
        /home/piro/go/src/github.com/harry1453/go-common-file-dialog/cfd/iFileOpenDialog.go:104 +0x41
github.com/harry1453/go-common-file-dialog/cfd.(*DialogConfig).apply(0x11c5deb8, 0x410754, 0x1222df0, 0x0, 0x0)
        /home/piro/go/src/github.com/harry1453/go-common-file-dialog/cfd/DialogConfig.go:99 +0xef
github.com/harry1453/go-common-file-dialog/cfd.NewOpenFileDialog(0x3e659e, 0x5, 0x3e7965, 0xc, 0x0, 0x0, 0x0, 0x0, 0x11c04180, 0x1, ...)
        /home/piro/go/src/github.com/harry1453/go-common-file-dialog/cfd/CommonFileDialog_windows.go:20 +0x76
github.com/harry1453/go-common-file-dialog/cfdutil.ShowOpenFileDialog(0x3e659e, 0x5, 0x3e7965, 0xc, 0x0, 0x0, 0x0, 0x0, 0x11c04180, 0x1, ...)
        /home/piro/go/src/github.com/harry1453/go-common-file-dialog/cfdutil/CFDUtil.go:9 +0x68
main.main()
        /home/piro/testcase.go:16 +0x8e
eax     0x140d8b64
ebx     0x0
ecx     0x1222de4
edx     0x140d8b66
edi     0x140d8b64
esi     0x0
ebp     0x10ff9d8
esp     0x10ff9d4
eip     0x779cef90
eflags  0x10202
cs      0x23
fs      0x53
gs      0x2b

C:\Users\piro>

Environment

  • host OS: Windows 10 Pro 21H1 (64bit)
  • guest OS: Ubuntu 18.04.5 LTS (on WSL1)
  • go: 1.16.6 linux/amd64
  • go-common-file-dialog revision: 5bfd608

Additional info

I've not tested this on 32bit Windows environment yet.

Cancelled flag

Currently, if the user presses cancel or closes a dialog, it returns an error with the text "cancelled by user". It would be great if Show() returned a flag indicating if it was cancelled. I realise this would be an API breaking change!

cfd.ErrorCancelled not declared by package cfd

Ola, when using this module, it seems that cfd.ErrorCancelled is no longer supported:

if err == cfd.ErrorCancelled { //<--- ErrorCancelled not declared by package cfdcompiler[UndeclaredImportedName]
   log.Fatal("Dialog was cancelled by the user.")
}

Is there an alternative way to check if a dialog was cancelled?
It could just be a mistake on my end, this is literally my first go project

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.