diff options
| author | Jeff Carr <[email protected]> | 2025-09-09 05:28:22 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-09 05:28:22 -0500 | 
| commit | 4fee86a80f84dd7c591935c7c5d7013adbab0b67 (patch) | |
| tree | cac233dd6a852fbb492e0a70f07e621dedce9570 | |
| parent | c71702102832061557ff3f8246a9f50dd8fbbab1 (diff) | |
updates for new GUI codebasev0.21.63v0.21.62v0.21.61v0.21.60v0.21.59v0.21.58v0.21.57v0.21.56v0.21.55v0.21.54v0.21.53v0.21.52v0.21.51v0.21.50v0.21.49v0.21.48v0.21.47
| -rw-r--r-- | argv.go | 18 | ||||
| -rw-r--r-- | main.go | 25 | ||||
| -rw-r--r-- | structs.go | 17 | 
3 files changed, 34 insertions, 26 deletions
@@ -1,12 +1,5 @@  package main -import ( -	"os" - -	"go.wit.com/dev/alexflint/arg" -	"go.wit.com/gui" -) -  /*  	this parses the command line arguements  	this enables command line options from other packages like 'gui' and 'log' @@ -24,17 +17,6 @@ This basicwindow example demonstrates multiple windows  `  } -func init() { -	gui.InitArg() -	pp := arg.MustParse(&argv) - -	// for very new users or users unfamilar with the command line, this may help them -	if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" { -		pp.WriteHelp(os.Stdout) -		os.Exit(0) -	} -} -  func (args) Version() string {  	return "basicwindow " + VERSION  } @@ -1,17 +1,18 @@  package main  import ( +	"os" + +	"go.wit.com/dev/alexflint/arg"  	"go.wit.com/gui"  	"go.wit.com/lib/gadgets" +	"go.wit.com/lib/gui/prep"  	"go.wit.com/log"  )  // sent via -ldflags  var VERSION string -// 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 @@ -25,20 +26,28 @@ var computers *gui.Node  var colors *gui.Node  func main() { -	myGui = gui.New() -	myGui.Default() -	myGui.LoadToolkit("gocui") +	me := new(mainType) +	me.myGui = prep.Gui() // prepares the GUI package for go-args +	me.pp = arg.MustParse(&argv) + +	// for very new users or users unfamilar with the command line, this may help them +	if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" { +		me.pp.WriteHelp(os.Stdout) +		os.Exit(0) +	} + +	me.myGui.Start() // loads the GUI toolkit (GO Plugins)  	helloworld()  	basicWindow = makebasicWindow() -	// go will sit here until the window exits +	// use this or make a loop to do something  	gui.Watchdog()  }  // This initializes the first window and some widgets  func helloworld() { -	mainWindow = myGui.NewWindow("primary helloworld window").SetProgName("BASEWIN1") +	mainWindow = gui.RawWindow("primary helloworld window").SetProgName("BASEWIN1")  	box := mainWindow.NewBox("vbox", false)  	group := box.NewGroup("choices") diff --git a/structs.go b/structs.go new file mode 100644 index 0000000..6251719 --- /dev/null +++ b/structs.go @@ -0,0 +1,17 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( +	"go.wit.com/dev/alexflint/arg" +	"go.wit.com/lib/gui/prep" +) + +var me *mainType + +// this app's variables +type mainType struct { +	pp    *arg.Parser   // for parsing the command line args.  Yay to alexf lint! +	myGui *prep.GuiPrep // the gui toolkit handle +}  | 
