Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-19 13:03:59 -06:00
parent 0c3ed55c33
commit 0e333cd78f
4 changed files with 65 additions and 6 deletions

View File

@ -1,19 +1,19 @@
all: build
reset
./basicwindow
./gadgetwindow
build:
ifeq ($(GO111MODULE),)
echo no. you must use GO111MODULE here
false
else
-rm -f basicwindow
-rm -f gadgetwindow
go build -v -x
endif
stderr: build
echo "writing to /tmp/basicwindow.stderr"
./basicwindow >/tmp/basicwindow.stderr 2>&1
echo "writing to /tmp/gadgetwindow.stderr"
./gadgetwindow >/tmp/gadgetwindow.stderr 2>&1
push:
git add --all

56
choices.go Normal file
View File

@ -0,0 +1,56 @@
// This creates a simple hello world window
package main
import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
type choices struct {
group *gui.Node // the group
grid *gui.Node // the grid
hello *gui.Node // the hello button
computers *gui.Node
colors *gui.Node
ol *gadgets.OneLiner
}
// This initializes the first window and some widgets
func newChoices(parent *gui.Node) *choices {
var c *choices
c = new(choices)
c.group = parent.NewGroup("choices")
c.grid = c.group.NewGrid("gridiron", 2, 1)
c.grid.NewButton("hello", func() {
log.Println("world")
})
c.grid.NewButton("show basic window", func() {
basicWindow.Toggle()
})
c.grid.NewLabel("a label")
c.computers = c.grid.NewDropdown().SetProgName("COMPUTERS")
c.computers.AddText("Atari 500")
c.computers.AddText("Beagleboard")
c.computers.AddText("Unmatched Rev B")
c.computers.AddText("asldjf")
c.computers.AddText("asdjf")
c.computers.AddText("a1jf")
c.computers.AddText("jf")
c.computers.SetText("Beagleboard")
c.colors = c.grid.NewCombobox().SetProgName("COLORS")
c.colors.AddText("Cyan")
c.colors.AddText("Magenta")
c.colors.AddText("Yellow")
c.colors.SetText("orange")
c.grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
c.ol = gadgets.NewOneLiner(c.grid, "two for one")
c.ol.SetValue("socks")
return c
}

View File

@ -27,7 +27,7 @@ func main() {
// myGui.LoadToolkit("nocui")
helloworld()
basicWindow = makebasicWindow()
// basicWindow = makebasicWindow()
// go will sit here until the window exits
gui.Watchdog()

View File

@ -21,7 +21,8 @@ func makebasicWindow() *gadgets.BasicWindow {
}
box1 := basicWindow.Box()
group1 := box1.NewGroup("choices")
vbox := mainWindow.NewBox("vbox", false)
group1 := vbox.NewGroup("choices")
group1.NewButton("hide apple", func() {
apple.Hide()
})
@ -37,5 +38,7 @@ func makebasicWindow() *gadgets.BasicWindow {
apple = group1.NewButton("apple", func() {
log.Info("is not a pear")
})
newChoices(box1)
return basicWindow
}