79409551

Date: 2025-02-03 17:26:20
Score: 0.5
Natty:
Report link

I've just used the dialog plugin to create a dialog. I'm not using the open file but I would like to share a snipped of what I did to open a dialog for Tauri V2 from Rust.

use tauri_plugin_dialog::DialogExt;

#[tauri::command]
fn app_exit (app: AppHandle)
{
    let is_confirmed = app.dialog()
        .message("Confirm quit?")
        .title("Quit")
        .kind(tauri_plugin_dialog::MessageDialogKind::Info)
        .buttons(tauri_plugin_dialog::MessageDialogButtons::YesNo)
        .blocking_show();

    if is_confirmed
    {
        app.exit(0);
    }
}

Link to the documentation if it could be useful:

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: magg