sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.58k stars 268 forks source link

selectFolder not opening dialog #180

Closed nosmokingbandit closed 5 years ago

nosmokingbandit commented 6 years ago

Windows 10 x64 Go 1.11 Sciter.dll 4.2.5.2 (latest as of yesterday when I downloaded it)

Attempting to make a simple folder picker dialog.

gui.html

<html>
  <head>
    <style>
    </style>
    <script type="text/tiscript">

        $(button#selectFolder).onClick = function(){
            var d = view.selectFolder();
            view.msgbox(d);
        }

    </script>
  </head>
<body>
    <button id="selectFolder">Click Me</button>

</body>
</html>

main.go

package main

import (
    "log"

    "github.com/sciter-sdk/go-sciter"
    "github.com/sciter-sdk/go-sciter/window"
)

func main() {
    sciter.SetOption(sciter.SCITER_SET_SCRIPT_RUNTIME_FEATURES, sciter.ALLOW_SOCKET_IO)
    sciter.SetOption(sciter.SCITER_SET_DEBUG_MODE, 1)

    w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN, nil)
    if err != nil {
        log.Fatal(err)
    }

    w.LoadFile("gui.html")
    w.Show()
    w.Run()
}

Opening the html document with sciter.exe works as expected. When running the program via go run the dialog doesn't open at all and the messagebox displays "{nothing?}".

Edit:

Seems like this is the case with selectFile as well.

pravic commented 5 years ago

Funny.

The culprit is sciter.ALLOW_SYSINFO flag (its absence). Add it and you are good to go. Or just add everything via 0xFFFFFFFF.