Here is the code that I’m using to test Fyne.
package userinterface
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
func Uirender() {
myApp := app.New()
myWindow := myApp.NewWindow("Hello World")
// Create menu items
fileMenuItem1 := fyne.NewMenuItem("File 1", nil)
// Create a menu and add the menu items to it
fileMenu := fyne.NewMenu(
fileMenuItem1,
)
// Create a menu bar and set the menu to it
mainMenu := fyne.NewMainMenu(
fileMenu,
)
// Set the menu bar as the window's main menu
myWindow.SetMainMenu(mainMenu)
// Create a simple content for the window
content := container.NewVBox(
widget.NewLabel("Hello World!"),
)
// Set the window's content
myWindow.SetContent(content)
// Show the window and run the app
myWindow.ShowAndRun()
}
Here is the error message
cannot use fileMenuItem1 (variable of type *fyne.MenuItem) as string value in argument to fyne.NewMenu
I haven’t seen much about this error with fyne on google,so I figured I’d ask here,