package main

import (
	"strings"

	"github.com/lxn/walk"
	. "github.com/lxn/walk/declarative"
)

func main() {
	var inTE, outTE *walk.TextEdit

//	initial := 30

	MainWindow{
		Title:   "Test",
		MinSize: Size{Width: 600, Height: 400},
		Layout:  VBox{},
		Children: []Widget{
			HSplitter{
				Children: []Widget{
					TextEdit{AssignTo: &inTE},
					TextEdit{AssignTo: &outTE, ReadOnly: true},
				},
			},
			PushButton{
				Text: "SCREAM",

				OnClicked: func() {
					outTE.SetText(strings.ToUpper(inTE.Text()))
				},
			},
			PushButton{
				Text: "Hello World !",
				OnClicked: func() {
					outTE.AppendText("Hello World !\n")
					outTE.AppendText("Nice to meet you !") // Cannot output with a new line
//					outTE.AppendText("The initial number is:", initial) // Cannot output as "fmt.Println" on text edit
				},
			},
			PushButton{
				Text: "Compute",
				OnClicked: func() {
					var input int
					outTE.SetText("Please enter a number:")
					// Read the value from the input text edit such as the "fmt.Scanf" function
					// Scanf("%d\n", input)
					PushButton{
						Text: "+",
						OnClicked: func() {
//						result := input + initial					
//						outTE.SetText("The result is:", result)
						},
					},
					PushButton{
						Text: "-",
						OnClicked: func() {
//						result := input - initial
//						outTE.SetText("The result is:", result)
						},
					},
					PushButton{
						Text: "*",
						OnClicked: func() {
//						result := input * initial
//						outTE.SetText("The result is:", result)
						},
					},
					PushButton{
						Text: "/",
						OnClicked: func() {
//						result := input +/initial
//						outTE.SetText("The result is:", result)
						},
					},
				},
			},
		},
	}.Run()
}
