2014-02-11 17:57:03 -06:00
|
|
|
// 11 february 2014
|
|
|
|
package main
|
|
|
|
|
|
|
|
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-12 20:28:58 -06:00
|
|
|
err := w.Open(b)
|
2014-02-11 18:34:28 -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-12 17:14:37 -06:00
|
|
|
err := w.SetTitle("Button Clicked")
|
|
|
|
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
|
|
|
}
|
|
|
|
|