I've tried to create new app window through window menu. But there i faced with issue that method
create_window
is not available
How can i do that?
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use tauri::{Menu, WindowMenuEvent, Wry, Submenu, CustomMenuItem, WindowUrl, WindowBuilder};
pub fn create() -> Menu {
let test_menu = Menu::new()
.add_item(CustomMenuItem::new("new_window", "Create new window"));
Menu::new()
.add_submenu(Submenu::new("Test", test_menu))
}
pub fn handler(event: WindowMenuEvent<Wry>) {
match event.menu_item_id() {
"new_window" => {
let mut window = event.window().clone();
}
_ => {}
}
}
fn main() {
tauri::Builder::default()
.menu(create())
.on_menu_event(handler)
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
I created menu and cloned main window(i need to create same window) in event