filedragdrop, how do I influence my UI with dragn drop? #1893
Answered
by
ealmloff
WyvernIXTL
asked this question in
Q&A
-
I don't understand the example use dioxus::prelude::*;
use dioxus_desktop::Config;
use dioxus_desktop::wry::webview::FileDropEvent;
fn main() {
let cfg = Config::new().with_file_drop_handler(|_w, e| {
match e {
FileDropEvent::Dropped { paths, .. } => { // here I get path when user drops file },
_ => {}
};
true
});
dioxus_desktop::launch_with_props(app, (), cfg);
}
fn app(cx: Scope) -> Element {
render! {
// my ui
// how do I influence it with the file path?
}
} The code in #95 does not work for me. |
Beta Was this translation helpful? Give feedback.
Answered by
ealmloff
Feb 5, 2024
Replies: 1 comment 1 reply
-
If you would like to accept a file on a specific element, a file input might be better. See this example: dioxus/examples/file_upload.rs Line 34 in 417cea7 You can use a hover selector in css to change the appearance of the element while you hover over it |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
WyvernIXTL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you would like to accept a file on a specific element, a file input might be better. See this example:
dioxus/examples/file_upload.rs
Line 34 in 417cea7
You can use a hover selector in css to change the appearance of the element while you hover over it