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/verticalLayout/main.go

35 lines
912 B
Go
Raw Normal View History

2023-01-09 19:22:08 -07:00
package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
import "git.tebibyte.media/sashakoshka/tomo/elements/layouts"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/x"
func main () {
tomo.Run(run)
}
func run () {
window, _ := tomo.NewWindow(2, 2)
window.SetTitle("vertical stack")
2023-01-10 14:39:37 -07:00
container := basic.NewContainer(layouts.Vertical { true, true })
window.Adopt(container)
2023-01-09 19:22:08 -07:00
2023-01-10 14:39:37 -07:00
label := basic.NewLabel("it is a label hehe")
button := basic.NewButton("press me")
button.OnClick (func () {
label.SetText (
"woah, this button changes the label text! since the " +
"size of this text box has changed, the window " +
"should expand (unless you resized it already).")
})
container.Adopt(label, true)
container.Adopt(basic.NewButton("yeah"), false)
container.Adopt(button, false)
2023-01-09 19:22:08 -07:00
window.OnClose(tomo.Stop)
window.Show()
}