diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -2,43 +2,42 @@ package main import ( + "go.wit.com/log" "go.wit.com/gui" "go.wit.com/lib/gadgets" - "go.wit.com/log" ) -var myGui *gui.Node // This is the beginning of the binary tree of widgets +// This is the beginning of the binary tree of widgets +var myGui *gui.Node + +// this is the primary window. If you close it, the program will exit +var mainWindow *gui.Node + +// this is a basic window. the user can open and close it +var basicWindow *gadgets.BasicWindow -// 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() } -// This initializes the first window, a group and a button +// This initializes the first window and some widgets func helloworld() { - basicWin := gadgets.NewBasicWindow(myGui, "basic window test") - basicWin.Make() - basicWin.StandardExit() - - box1 := basicWin.Box() - group1 := box1.NewGroup("choices") - group1.NewButton("hello", func() {}) - basicWin.Draw() + mainWindow = myGui.NewWindow("hello world") - window := myGui.NewWindow("hello world") - - box := window.NewBox("vbox", false) + box := mainWindow.NewBox("vbox", false) group := box.NewGroup("choices") grid := group.NewGrid("gridiron", 2, 1) grid.NewButton("hello", func() { log.Println("world") }) - grid.NewButton("in", func() { - log.Println("out") + grid.NewButton("show basic window", func() { + makebasicWindow() }) grid.NewLabel("apple") @@ -58,6 +57,8 @@ func helloworld() { cb.AddText("Yellow") cb.SetText("orange") + grid.NewCheckbox("Checkers").SetProgName("CHECKERS") + queryGroup := box.NewGroup("query") queryGroup.NewButton("Which Computer?", func() { |
