28 lines
402 B
Go
28 lines
402 B
Go
// 11 february 2014
|
|
package main
|
|
|
|
func main() {
|
|
w := NewWindow("Main Window", 320, 240)
|
|
w.Closing = make(chan struct{})
|
|
b := NewButton("Click Me")
|
|
w.SetControl(b)
|
|
err := w.Open()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
mainloop:
|
|
for {
|
|
select {
|
|
case <-w.Closing:
|
|
break mainloop
|
|
case <-b.Clicked:
|
|
err := w.SetTitle("Button Clicked")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
}
|
|
w.Close()
|
|
}
|
|
|