Compare commits

..

No commits in common. "guimaster" and "v0.21.45" have entirely different histories.

3 changed files with 26 additions and 34 deletions

18
argv.go
View File

@ -1,5 +1,12 @@
package main package main
import (
"os"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
)
/* /*
this parses the command line arguements this parses the command line arguements
this enables command line options from other packages like 'gui' and 'log' this enables command line options from other packages like 'gui' and 'log'
@ -17,6 +24,17 @@ 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 { func (args) Version() string {
return "basicwindow " + VERSION return "basicwindow " + VERSION
} }

25
main.go
View File

@ -1,18 +1,17 @@
package main package main
import ( import (
"os"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/prep"
"go.wit.com/log" "go.wit.com/log"
) )
// sent via -ldflags // sent via -ldflags
var VERSION string 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 // this is the primary window. If you close it, the program will exit
var mainWindow *gui.Node var mainWindow *gui.Node
@ -26,28 +25,20 @@ var computers *gui.Node
var colors *gui.Node var colors *gui.Node
func main() { func main() {
me := new(mainType) myGui = gui.New()
me.myGui = prep.Gui() // prepares the GUI package for go-args myGui.Default()
me.pp = arg.MustParse(&argv) myGui.LoadToolkit("gocui")
// 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() helloworld()
basicWindow = makebasicWindow() basicWindow = makebasicWindow()
// use this or make a loop to do something // go will sit here until the window exits
gui.Watchdog() gui.Watchdog()
} }
// This initializes the first window and some widgets // This initializes the first window and some widgets
func helloworld() { func helloworld() {
mainWindow = gui.RawWindow("primary helloworld window").SetProgName("BASEWIN1") mainWindow = myGui.NewWindow("primary helloworld window").SetProgName("BASEWIN1")
box := mainWindow.NewBox("vbox", false) box := mainWindow.NewBox("vbox", false)
group := box.NewGroup("choices") group := box.NewGroup("choices")

View File

@ -1,17 +0,0 @@
// 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
}