hidden settings seem to work
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
0e333cd78f
commit
e1e453a574
3
Makefile
3
Makefile
|
@ -20,6 +20,9 @@ push:
|
|||
git commit -a
|
||||
git push
|
||||
|
||||
goimports:
|
||||
goimports -w *.go
|
||||
|
||||
redomod:
|
||||
rm -f go.*
|
||||
goimports -w *.go
|
||||
|
|
19
choices.go
19
choices.go
|
@ -8,13 +8,13 @@ import (
|
|||
)
|
||||
|
||||
type choices struct {
|
||||
group *gui.Node // the group
|
||||
grid *gui.Node // the grid
|
||||
hello *gui.Node // the hello button
|
||||
group *gui.Node // the group
|
||||
grid *gui.Node // the grid
|
||||
hello *gui.Node // the hello button
|
||||
computers *gui.Node
|
||||
colors *gui.Node
|
||||
colors *gui.Node
|
||||
|
||||
ol *gadgets.OneLiner
|
||||
socks *gadgets.OneLiner
|
||||
}
|
||||
|
||||
// This initializes the first window and some widgets
|
||||
|
@ -49,8 +49,13 @@ func newChoices(parent *gui.Node) *choices {
|
|||
|
||||
c.grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
|
||||
|
||||
c.ol = gadgets.NewOneLiner(c.grid, "two for one")
|
||||
c.ol.SetValue("socks")
|
||||
c.socks = gadgets.NewOneLiner(c.grid, "two for one")
|
||||
c.socks.SetValue("socks")
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *choices) SetSocks(s string) *choices {
|
||||
c.socks.SetValue(s)
|
||||
return c
|
||||
}
|
||||
|
|
6
go.mod
6
go.mod
|
@ -1,10 +1,10 @@
|
|||
module go.wit.com/apps/basicwindow
|
||||
module go.wit.com/apps/gadgetwindow
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
go.wit.com/gui v0.12.17
|
||||
go.wit.com/lib/gadgets v0.12.11
|
||||
go.wit.com/gui v0.12.18
|
||||
go.wit.com/lib/gadgets v0.12.13
|
||||
go.wit.com/log v0.5.5
|
||||
)
|
||||
|
||||
|
|
8
go.sum
8
go.sum
|
@ -4,10 +4,10 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
|
|||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||
go.wit.com/gui v0.12.17 h1:O7fdI8dwDA8/TfkO0RN6LCK05dDiQRTE1Zvek1Imkrc=
|
||||
go.wit.com/gui v0.12.17/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
|
||||
go.wit.com/lib/gadgets v0.12.11 h1:IgElPe2dFQq9xOQKtAx44Icfzf3tYEPP8NAhlXNUb2A=
|
||||
go.wit.com/lib/gadgets v0.12.11/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M=
|
||||
go.wit.com/gui v0.12.18 h1:gFVDaJFz/Su8JgUd9Oxnb3t+FS+bzy5WJSvGoKVGYZU=
|
||||
go.wit.com/gui v0.12.18/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
|
||||
go.wit.com/lib/gadgets v0.12.13 h1:CEPUa+rH4VjmxtaWWSqvhgGEhpIjq8zuc01FIJ62xfA=
|
||||
go.wit.com/lib/gadgets v0.12.13/go.mod h1:u+Syal5qdem7fEikOiEJdI+dO2zOybfa6vZ9ptF+bJ8=
|
||||
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
|
||||
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=
|
||||
|
|
73
main.go
73
main.go
|
@ -3,6 +3,7 @@ package main
|
|||
|
||||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -16,18 +17,18 @@ var mainWindow *gui.Node
|
|||
// this is a basic window. the user can open and close it
|
||||
var basicWindow *gadgets.BasicWindow
|
||||
|
||||
// the computers dropdown
|
||||
var computers *gui.Node
|
||||
|
||||
// the colors combobox
|
||||
var colors *gui.Node
|
||||
// the widget structure for both windows
|
||||
var section1 *choices
|
||||
var section2 *choices
|
||||
|
||||
func main() {
|
||||
myGui = gui.New().Default()
|
||||
myGui = gui.New()
|
||||
myGui.LoadToolkit("andlabs")
|
||||
// myGui.LoadToolkit("nocui")
|
||||
myGui.Default()
|
||||
|
||||
helloworld()
|
||||
// basicWindow = makebasicWindow()
|
||||
basicWindow = makebasicWindow()
|
||||
|
||||
// go will sit here until the window exits
|
||||
gui.Watchdog()
|
||||
|
@ -37,54 +38,42 @@ func main() {
|
|||
func helloworld() {
|
||||
mainWindow = myGui.NewWindow("hello world").SetProgName("BASEWIN1")
|
||||
|
||||
box := mainWindow.NewBox("vbox", false)
|
||||
group := box.NewGroup("choices")
|
||||
grid := group.NewGrid("gridiron", 2, 1)
|
||||
grid.NewButton("hello", func() {
|
||||
log.Println("world")
|
||||
})
|
||||
grid.NewButton("show basic window", func() {
|
||||
box := mainWindow.NewBox("hbox", true)
|
||||
section1 = newChoices(box)
|
||||
|
||||
group := box.NewGroup("interact")
|
||||
group.NewButton("show basic window", func() {
|
||||
basicWindow.Toggle()
|
||||
})
|
||||
grid.NewLabel("a label")
|
||||
|
||||
computers = grid.NewDropdown().SetProgName("COMPUTERS")
|
||||
computers.AddText("Atari 500")
|
||||
computers.AddText("Beagleboard")
|
||||
computers.AddText("Unmatched Rev B")
|
||||
computers.AddText("asldjf")
|
||||
computers.AddText("asdjf")
|
||||
computers.AddText("a1jf")
|
||||
computers.AddText("jf")
|
||||
computers.SetText("Beagleboard")
|
||||
|
||||
colors = grid.NewCombobox().SetProgName("COLORS")
|
||||
colors.AddText("Cyan")
|
||||
colors.AddText("Magenta")
|
||||
colors.AddText("Yellow")
|
||||
colors.SetText("orange")
|
||||
|
||||
grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
|
||||
|
||||
queryGroup := box.NewGroup("interact")
|
||||
|
||||
queryGroup.NewButton("Which Computer?", func() {
|
||||
tmp := computers.String()
|
||||
group.NewButton("Which Computer?", func() {
|
||||
tmp := section1.computers.String()
|
||||
log.Println("computer =", tmp)
|
||||
for i, s := range computers.Strings() {
|
||||
for i, s := range section1.computers.Strings() {
|
||||
log.Println("has option", i, s)
|
||||
}
|
||||
})
|
||||
|
||||
queryGroup.NewButton("Which Color?", func() {
|
||||
tmp := colors.String()
|
||||
group.NewButton("Which Color?", func() {
|
||||
tmp := section1.colors.String()
|
||||
log.Println("color =", tmp)
|
||||
})
|
||||
|
||||
queryGroup.NewButton("Show apple", func() {
|
||||
group.NewButton("Show apple", func() {
|
||||
apple.Show()
|
||||
})
|
||||
queryGroup.NewButton("Hide apple", func() {
|
||||
group.NewButton("Hide apple", func() {
|
||||
apple.Hide()
|
||||
})
|
||||
group.NewButton("set socks", func() {
|
||||
section1.SetSocks("blue")
|
||||
section2.SetSocks("green")
|
||||
})
|
||||
group.NewButton("show socks", func() {
|
||||
log.Info("main window socks =", section1.socks.String())
|
||||
log.Info("basic window socks =", section2.socks.String())
|
||||
})
|
||||
group.NewButton("debugger", func() {
|
||||
debugger.DebugWindow(myGui)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,15 +14,17 @@ var apple *gui.Node
|
|||
func makebasicWindow() *gadgets.BasicWindow {
|
||||
log.Warn("start basicWindow")
|
||||
basicWindow = gadgets.NewBasicWindow(myGui, "basic window test")
|
||||
basicWindow.Make()
|
||||
basicWindow.StandardClose()
|
||||
basicWindow.Custom = func() {
|
||||
log.Warn("got to close")
|
||||
}
|
||||
basicWindow.Make()
|
||||
basicWindow.StandardClose()
|
||||
|
||||
box1 := basicWindow.Box()
|
||||
vbox := mainWindow.NewBox("vbox", false)
|
||||
group1 := vbox.NewGroup("choices")
|
||||
section2 = newChoices(box1)
|
||||
|
||||
vbox := box1.NewBox("vbox", false)
|
||||
group1 := vbox.NewGroup("controls").Horizontal() // Vertical()
|
||||
group1.NewButton("hide apple", func() {
|
||||
apple.Hide()
|
||||
})
|
||||
|
@ -30,15 +32,14 @@ func makebasicWindow() *gadgets.BasicWindow {
|
|||
apple.Show()
|
||||
})
|
||||
group1.NewButton("hide computers", func() {
|
||||
computers.Hide()
|
||||
section2.computers.Hide()
|
||||
})
|
||||
group1.NewButton("show computers", func() {
|
||||
computers.Show()
|
||||
section2.computers.Show()
|
||||
})
|
||||
apple = group1.NewButton("apple", func() {
|
||||
log.Info("is not a pear")
|
||||
})
|
||||
|
||||
newChoices(box1)
|
||||
return basicWindow
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue