fluxxcode / egui-file-dialog

Full featured and customizable file dialog for egui
MIT License
87 stars 11 forks source link

possible name collision? #96

Closed diniremix closed 8 months ago

diniremix commented 8 months ago

Hi, thanks for sharing this crate! on Windows using egui 0.26.0, i get this.

https://i.imgur.com/Nbln3pK.gifv

it could be name collision?, seen in the egui documentation at

sorry for the bad translation, I do not speak English and I am using google translate.

fluxxcode commented 8 months ago

Hi, thanks for the issue!

Interesting, I haven't had that problem yet and haven't seen it before. Especially since the error only occurs while scrolling.

Do you have a repository somewhere where I can reproduce the error?

diniremix commented 8 months ago

of course!, thank you very much for the quick response and sorry for the delay. the project aims to open and process a json file, and display the content, I will upload the repo in these days, while I organize the mess a little 😄

[dependencies]
egui = "0.26.0"
eframe = "0.26.0"
egui_extras = { version = "0.26.0"}
serde = { version = "~1.0", features = ["derive"] }
serde_json = { version = "~1.0" }
jsonschema = { version = "~0.17", features = ["draft202012"] }
# jsonpath_lib = "0.3.0"
jmespath = "0.3.0"
egui-file-dialog = "0.2.0"

what may be different is the use of additional options for eframe and derive.

use std::path::PathBuf;

use eframe::egui;
use egui_file_dialog::FileDialog;

#[derive(Default)]
struct MyApp {
    file_dialog: FileDialog,
    selected_file: Option<PathBuf>,
}

let options = eframe::NativeOptions {
    centered: true,
    viewport: egui::ViewportBuilder::default()
        .with_inner_size([900.0, 800.0]) // ancho - alto
        .with_min_inner_size([800.0, 600.0])
        .with_max_inner_size([1000.0, 900.0])
        .with_maximize_button(false),
    ..Default::default()
};
eframe::run_native("Roaspy", options,  Box::new(|_cc| Box::<MyApp>::default()))

and the part where the file is read...

egui::CentralPanel::default().show(ctx, |ui| {
    if let Some(path) = self.file_dialog.update(ctx).selected() {
        self.selected_file = Some(path.to_path_buf());
        let result = validate_file(path);

        match result {
            Ok(data) => {
                println!("leyendo el archivo: listo!");
                println!("la data: {:?}", data);
                self.data_to_draw = Some(data);
            }
            Err(err) => {
                self.data_to_draw = None;
                self.show_dialog_info = true;
                println!("ocurrio un error al leer el archivo: {}", err);
            }
        } // match
    }
 }); //CentralPanel

environment:

fluxxcode commented 8 months ago

I still can't reproduce the error with the same environment and options🤔

Let me know when your project is publicly available in a repo. Then I'll see if I can reproduce it with the same project :)

You can also try updating egui and eframe to version 0.26.2. egui-file-dialog now also has version 0.4.0 :)

jorgebrunal commented 8 months ago

I have upgraded to egui-file-dialog to 0.4.0 and egui to version 0.26.2 and the problem does not appear, in fact I can no longer replicate the error. :smile:

By the way, the implementation of

self.file_dialog.update(ctx);
if let Some(path) = self.file_dialog.take_selected(){
 ...
}

has been a great help, thank you very much!

I think we can close this issue...