2014-02-11 17:57:03 -06:00
|
|
|
// 11 february 2014
|
|
|
|
package main
|
|
|
|
|
2014-02-13 14:14:10 -06:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2014-02-11 17:57:03 -06:00
|
|
|
func main() {
|
2014-02-12 09:51:27 -06:00
|
|
|
w := NewWindow("Main Window", 320, 240)
|
2014-02-11 17:57:03 -06:00
|
|
|
w.Closing = make(chan struct{})
|
2014-02-12 10:29:20 -06:00
|
|
|
b := NewButton("Click Me")
|
2014-02-13 11:26:43 -06:00
|
|
|
c := NewCheckbox("Check Me")
|
2014-02-14 09:58:16 -06:00
|
|
|
s := NewStack(Vertical, b, c)
|
2014-02-13 16:04:57 -06:00
|
|
|
err := w.Open(s)
|
2014-02-13 11:26:43 -06:00
|
|
|
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()))
|
2014-02-12 17:14:37 -06:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-02-12 10:29:20 -06:00
|
|
|
}
|
|
|
|
}
|
2014-02-12 20:28:58 -06:00
|
|
|
w.Hide()
|
2014-02-11 17:57:03 -06:00
|
|
|
}
|
|
|
|
|