andlabs-ui/main.go

34 lines
493 B
Go
Raw Normal View History

// 11 february 2014
package main
2014-02-13 14:14:10 -06:00
import (
"fmt"
)
func main() {
w := NewWindow("Main Window", 320, 240)
w.Closing = make(chan struct{})
2014-02-12 10:29:20 -06:00
b := NewButton("Click Me")
c := NewCheckbox("Check Me")
s := NewStack(Vertical, b, c)
2014-02-13 16:04:57 -06:00
err := w.Open(s)
if err != nil {
panic(err)
}
2014-02-12 10:29:20 -06:00
mainloop:
for {
select {
case <-w.Closing:
break mainloop
case <-b.Clicked:
2014-02-13 14:14:10 -06:00
err := w.SetTitle(fmt.Sprintf("Check State: %v", c.Checked()))
if err != nil {
panic(err)
}
2014-02-12 10:29:20 -06:00
}
}
w.Hide()
}