#Base Menu not working

3 messages · Page 1 of 1 (latest)

silk token
#

Hey all,

My window submenus are working as expected, but on MacOS nothing is showing up under the "base" menu (not sure what to call this, it's the submenu to the right of the Apple logo that's labeled with the app name).

In the code below, I'm trying to add to this with the items in the with_items call but they don't show up.

    let save = CustomMenuItem::new("save", "Save Project").accelerator("cmdOrControl+S");
    let debug_refresh =
        CustomMenuItem::new("debug_refresh", "Debug Refresh").accelerator("cmdOrControl+G");
    let mut file_menu = Menu::new()
        .add_native_item(MenuItem::CloseWindow)
        .add_item(save);
    #[cfg(debug_assertions)]
    {
        file_menu = file_menu.add_item(debug_refresh);
    }
    let file = Submenu::new("File", file_menu);
    let window = Submenu::new(
        "Window",
        Menu::new()
            .add_native_item(MenuItem::Minimize)
            .add_native_item(MenuItem::Zoom),
    );
    let view = Submenu::new(
        "View",
        Menu::new().add_native_item(MenuItem::EnterFullScreen),
    );
    let about_metadata = AboutMetadata::new()
        .version("0.0.0".to_string())
        .authors(["Author Name".to_string()].to_vec())
        .website("www.website.com".to_string());
    let menu = Menu::with_items([
        MenuItem::Separator.into(),
        MenuItem::About("App Name".into(), about_metadata).into(),
        MenuItem::Separator.into(),
        MenuItem::Quit.into(),
    ])
        .add_submenu(file)
        .add_submenu(window)
        .add_submenu(view);

Then I add this menu with .menu(menu) in my builder call.

tacit oriole
#

try making it a submenu too like ```rs
let about = Submenu::new("appname", Menu::with_items([
MenuItem::Separator.into(),
MenuItem::About("App Name".into(), about_metadata).into(),
MenuItem::Separator.into(),
MenuItem::Quit.into(),
]));
let menu = Menu::new().add_submenu(about)
.add_submenu(file)
.add_submenu(window)
.add_submenu(view);

silk token
#

Wow, that worked! I thought that would just add a duplicate menu next to the existing one, but I guess not. Thanks Fabian!