asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MacOS menu not displayed

roromix opened this issue · comments

I have tried to add a menu directly to the app, it display properly on Windows but isn't displayed on MacOS

	m := a.NewMenu([]*astilectron.MenuItemOptions{
		{
			Label: astikit.StrPtr("Menu1"),
			OnClick: func(e astilectron.Event) (deleteLister bool) {
				window.SendMessage("menu1")
				return
			},
		},
		{
			Label: astikit.StrPtr("Menu 2"),
			OnClick: func(e astilectron.Event) (deleteLister bool) {
				window.SendMessage("menu2")
				return
			},
		},
		{
			Label: astikit.StrPtr("Help"),
			SubMenu: []*astilectron.MenuItemOptions{
				{
					Label: astikit.StrPtr("About"),
					OnClick: func(e astilectron.Event) (deleteLister bool) {
						createAboutPopin()
						return
					},
				},
			},
		},
	})
	err := m.Create()
	checkError(err)

Has anyone ever managed to display a menu on MacOS, and how?

The menu in the demo should be working in MacOS. If you only keep the third item in your menu, does it work in MacOS (I think menus need to have a SubMenu in MacOS)

@asticode : Yes, I have tested, it's now ok. Thanks a lot

And i have created a PR