This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/examples/input/main.go

45 lines
1.2 KiB
Go
Raw Normal View History

2023-01-18 05:38:58 +00:00
package main
import "git.tebibyte.media/sashakoshka/tomo"
2023-01-18 06:29:59 +00:00
import "git.tebibyte.media/sashakoshka/tomo/popups"
2023-01-18 05:38:58 +00:00
import "git.tebibyte.media/sashakoshka/tomo/layouts"
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/x"
func main () {
tomo.Run(run)
}
func run () {
window, _ := tomo.NewWindow(2, 2)
window.SetTitle("Approaching")
container := basic.NewContainer(layouts.Vertical { true, true })
window.Adopt(container)
firstName := basic.NewTextBox("First name", "")
lastName := basic.NewTextBox("Last name", "")
fingerLength := basic.NewTextBox("Length of fingers", "")
button := basic.NewButton("Ok")
2023-01-18 06:29:59 +00:00
lastName.SetEnabled(false)
button.OnClick (func () {
popups.NewDialog (
popups.DialogKindInfo,
"Profile",
firstName.Value() + " [REDACTED]'s fingers\n" +
"measure in at " + fingerLength.Value() + " feet.")
})
2023-01-18 05:38:58 +00:00
container.Adopt(basic.NewLabel("Choose your words carefully.", false), true)
container.Adopt(firstName, false)
container.Adopt(lastName, false)
container.Adopt(fingerLength, false)
container.Adopt(basic.NewSpacer(true), false)
container.Adopt(button, false)
firstName.Select()
window.OnClose(tomo.Stop)
window.Show()
}