Git Product home page Git Product logo

Comments (9)

bytebuddha avatar bytebuddha commented on July 29, 2024 1

Of coarse here is a test program showing the bug

extern crate web_view;


use web_view::WebView;
use web_view::MyUnique;
use web_view::Content;
use web_view::Dialog;
use web_view::Alert;
use web_view::run;

const HTML: &str = r#"
<DOCTYPE html>
<html>
  <body>
      <button onclick="window.external.invoke('open')">Open File Dialog</button>
      <button onclick="window.external.invoke('save')">Save File Dialog</button>
      <button onclick="window.external.invoke('directory')">Choose Directory Dialog</button>
      <button onclick="window.external.invoke('alert-info')">Info Alert</button>
      <button onclick="window.external.invoke('alert-warning')">Warning Alert</button>
      <button onclick="window.external.invoke('alert-error')">Error Alert</button>
  </body>
</html>
"#;

fn callback(view: &mut WebView<()>, arg: &str, user_data: &mut ()) {
    match arg {
        "open" => {
            println!("Attempting to open 'OpenFile' dialog");
            view.dialog(Dialog::OpenFile, "Test Open Dialog", "");
        },
        "save" => {
            println!("Attempting to open 'SaveFile' dialog");
            view.dialog(Dialog::SaveFile, "Test Open Dialog", "");
        },
        "directory" => {
            println!("Attempting to open 'ChooseDirectory' dialog");
            view.dialog(Dialog::ChooseDirectory, "Choose Directory Dialog", "");
        },
        "alert-info" => {
            println!("Attempting to open info alert");
            view.dialog(Dialog::Alert(Alert::Info), "Info Alert", "");
        },
        "alert-warning" => {
            println!("Attempting to open warning alert");
            view.dialog(Dialog::Alert(Alert::Warning), "Info Alert", "");
        },
        "alert-error" => {
            println!("Attempting to open error alert");
            view.dialog(Dialog::Alert(Alert::Error), "Info Alert", "");
        }
        _ => {}
    }
}

fn main() {
    let (_, _) = run("open dialog test",
            Content::Html(HTML),
            Some((500, 500)),
            true,
            true,
            |_|{},
            callback,
            ()
        );

}

All of the alerts work so ignore those, but none of the file dialog's ever open

from web-view.

Boscop avatar Boscop commented on July 29, 2024

Not sure, I only have Win 8.1.
Do you have a minimal test example that exhibits the same behavior?
Maybe someone who also has Win 10 can test this..

from web-view.

richardhozak avatar richardhozak commented on July 29, 2024

This is the strangest thing, in order to debug this, I tried to put some debug prints into original c webview source code. With the printf statements in, everything works, when I comment them out, it does not work.

from web-view.

bytebuddha avatar bytebuddha commented on July 29, 2024

@Zxey I got fed up with Windows and installed Ubuntu at work so i no longer have the means to work on this.

After reading that I think it has something to do with building webview in the build script of the webview-sys crate. Maybe something isn't getting linked correctly? I am very new to C so maybe that's a stupid question. But if there is anything i can do to help debug let me know!

from web-view.

richardhozak avatar richardhozak commented on July 29, 2024

I found that that it does not work for me when i build webview in debug mode, but it works when i build it with release mode.

from web-view.

richardhozak avatar richardhozak commented on July 29, 2024

Seems like it is uninitialized variable in webview in c code.

from web-view.

richardhozak avatar richardhozak commented on July 29, 2024

Created PR in original webview library. Should be fixed when webview/webview#214 gets merged upstream. We can then update our submodule and get the fix.

from web-view.

nmsobri avatar nmsobri commented on July 29, 2024

Is the PR being merged already?
I can concur this problem still exist on windows 10

from web-view.

prixt avatar prixt commented on July 29, 2024

This also happens to me on Window 10, but only on the stable-msvc toolchain. Dialog functions normally when built on the stable-gnu toolchain.
nvm, still having the same problem.

from web-view.

Related Issues (20)

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.