diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 73 |
1 files changed, 31 insertions, 42 deletions
@@ -3,6 +3,7 @@ package main import ( "go.wit.com/gui" + "go.wit.com/lib/debugger" "go.wit.com/lib/gadgets" "go.wit.com/log" ) @@ -16,18 +17,18 @@ var mainWindow *gui.Node // this is a basic window. the user can open and close it var basicWindow *gadgets.BasicWindow -// the computers dropdown -var computers *gui.Node - -// the colors combobox -var colors *gui.Node +// the widget structure for both windows +var section1 *choices +var section2 *choices func main() { - myGui = gui.New().Default() + myGui = gui.New() + myGui.LoadToolkit("andlabs") // myGui.LoadToolkit("nocui") + myGui.Default() helloworld() - // basicWindow = makebasicWindow() + basicWindow = makebasicWindow() // go will sit here until the window exits gui.Watchdog() @@ -37,54 +38,42 @@ func main() { func helloworld() { mainWindow = myGui.NewWindow("hello world").SetProgName("BASEWIN1") - box := mainWindow.NewBox("vbox", false) - group := box.NewGroup("choices") - grid := group.NewGrid("gridiron", 2, 1) - grid.NewButton("hello", func() { - log.Println("world") - }) - grid.NewButton("show basic window", func() { + box := mainWindow.NewBox("hbox", true) + section1 = newChoices(box) + + group := box.NewGroup("interact") + group.NewButton("show basic window", func() { basicWindow.Toggle() }) - grid.NewLabel("a label") - - computers = grid.NewDropdown().SetProgName("COMPUTERS") - computers.AddText("Atari 500") - computers.AddText("Beagleboard") - computers.AddText("Unmatched Rev B") - computers.AddText("asldjf") - computers.AddText("asdjf") - computers.AddText("a1jf") - computers.AddText("jf") - computers.SetText("Beagleboard") - - colors = grid.NewCombobox().SetProgName("COLORS") - colors.AddText("Cyan") - colors.AddText("Magenta") - colors.AddText("Yellow") - colors.SetText("orange") - grid.NewCheckbox("Checkers").SetProgName("CHECKERS") - - queryGroup := box.NewGroup("interact") - - queryGroup.NewButton("Which Computer?", func() { - tmp := computers.String() + group.NewButton("Which Computer?", func() { + tmp := section1.computers.String() log.Println("computer =", tmp) - for i, s := range computers.Strings() { + for i, s := range section1.computers.Strings() { log.Println("has option", i, s) } }) - queryGroup.NewButton("Which Color?", func() { - tmp := colors.String() + group.NewButton("Which Color?", func() { + tmp := section1.colors.String() log.Println("color =", tmp) }) - queryGroup.NewButton("Show apple", func() { + group.NewButton("Show apple", func() { apple.Show() }) - queryGroup.NewButton("Hide apple", func() { + group.NewButton("Hide apple", func() { apple.Hide() }) + group.NewButton("set socks", func() { + section1.SetSocks("blue") + section2.SetSocks("green") + }) + group.NewButton("show socks", func() { + log.Info("main window socks =", section1.socks.String()) + log.Info("basic window socks =", section2.socks.String()) + }) + group.NewButton("debugger", func() { + debugger.DebugWindow(myGui) + }) } |
