mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Tidy Up dialog
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
wails "github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
)
|
||||
|
||||
@@ -17,20 +14,6 @@ type Dialog struct {
|
||||
func (l *Dialog) WailsInit(runtime *wails.Runtime) error {
|
||||
// Perform your setup here
|
||||
l.runtime = runtime
|
||||
|
||||
// Setup Menu Listeners
|
||||
l.runtime.Menu.On("hello", func(m *menu.MenuItem) {
|
||||
fmt.Printf("The '%s' menu was clicked\n", m.Label)
|
||||
})
|
||||
l.runtime.Menu.On("checkbox-menu", func(m *menu.MenuItem) {
|
||||
fmt.Printf("The '%s' menu was clicked\n", m.Label)
|
||||
fmt.Printf("It is now %v\n", m.Checked)
|
||||
// m.Checked = false
|
||||
// runtime.Menu.Update()
|
||||
})
|
||||
l.runtime.Menu.On("😀option-1", func(m *menu.MenuItem) {
|
||||
fmt.Printf("We can use UTF-8 IDs: %s\n", m.Label)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ func main() {
|
||||
app.Bind(&System{})
|
||||
app.Bind(&Dialog{})
|
||||
app.Bind(&Window{})
|
||||
app.Bind(&Menu{})
|
||||
|
||||
app.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user