Menu

Struct

FileDialogResponder

kurogane::FileDialogResponderSource
pub struct FileDialogResponder { /* private fields */ }

Answers a FileDialogRequest the hook left for later (FileDialogDecision::Later), from any thread.

A request is answered once and the first answer counts. Dropping every responder of a request without answering cancels it. An answer that comes after the page went away gives it nothing.

App::new("./dist")
    .on_file_dialog(|request, _| {
        let responder = request.responder();
        std::thread::spawn(move || match pick_files() {
            Some(files) => responder.select(files),
            None => responder.cancel(),
        });
        FileDialogDecision::Later
    })
    .run_or_exit();

Methods

#pub fn select(self, files: Vec<PathBuf>)

Gives the page files, as FileDialogDecision::Files does.

#pub fn cancel(self)

Tells the page the user cancelled.

Trait implementations