diff --git a/main.go b/main.go index dbfd862..141b834 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// This creates a simple hello world window +// This creates a simple helloworld window package main import ( @@ -6,14 +6,15 @@ import ( "go.wit.com/log" ) -var myGui *gui.Node // This is the beginning of the binary tree of widgets +// This is the beginning of our binary tree of widgets +var myGui *gui.Node -// go will sit here until the window exits func main() { myGui = gui.New().Default() - myGui.LoadToolkit("nocui") helloworld() + + // go will sit here until the window exits gui.Watchdog() } @@ -24,6 +25,7 @@ func helloworld() { box := window.NewBox("vbox", false) group := box.NewGroup("groupy") grid := group.NewGrid("gridiron", 2, 1) + grid.NewButton("hello", func() { log.Println("world") }) @@ -41,10 +43,17 @@ func helloworld() { dd.AddText("a1jf") dd.AddText("jf") - cb := grid.NewCombobox().SetProgName("COLORS") - cb.AddText("Cyan") - cb.AddText("Magenta") - cb.AddText("Yellow") + color := grid.NewCombobox().SetProgName("COLORS") + color.AddText("Cyan") + color.AddText("Magenta") + color.AddText("Yellow") + color.Custom = func () { + log.Info("color is now", color.String()) + } - grid.NewCheckbox("Checkers").SetProgName("CHECKERS") + + check := grid.NewCheckbox("Checkers").SetProgName("CHECKERS") + check.Custom = func() { + log.Info("Checkers is now", check.Bool()) + } }