From 05311315ce1a1087139f8af5df98a77aedf5a067 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Jan 2024 19:29:02 -0600 Subject: runs. now to fix basic window os.Exit() Signed-off-by: Jeff Carr --- main.go | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4ff2388..c1acfde 100644 --- a/main.go +++ b/main.go @@ -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() { -- cgit v1.2.3