package main
import (
"fmt"
"github.com/atotto/clipboard"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
// https://pkg.go.dev/github.com/lxn/walk?utm_source=gopls
func main() {
var inTE, outTE *walk.TextEdit
go func() {
return
}()
g := func() {
f := func(s string) {
// ♘
clipboard.WriteAll(s)
outTE.SetText(s)
_, _ = clipboard.ReadAll()
}
choice := fmt.Sprint(inTE.Text())
switch choice {
case "1":
f("ā")
case "2":
f("á")
case "3":
f("ǎ")
case "4":
f("à")
default:
f("input your choice: 1ā\n2á\n3ǎ\n4ǎ on the left side")
}
}
MainWindow{
Title: "Convert",
MaxSize: Size{64, 64},
MinSize: Size{32, 32},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "Run",
OnClicked: func() {
outTE.SetText(inTE.Text())
g()
inTE.SetText("")
},
},
},
}.Run()
}