summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-19 00:34:15 -0600
committerJeff Carr <[email protected]>2024-01-19 00:34:15 -0600
commit99de2790d59a136e7b5f158d65965375b6c5e8f7 (patch)
tree6cede69073fa120b9a33b829ff26439e4314708b /main.go
parentcdeb6042fc879132349b3fc2faffedf48b8bdfb6 (diff)
show & hide tests
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go53
1 files changed, 33 insertions, 20 deletions
diff --git a/main.go b/main.go
index 69c7f06..5774340 100644
--- a/main.go
+++ b/main.go
@@ -2,9 +2,9 @@
package main
import (
- "go.wit.com/log"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
+ "go.wit.com/log"
)
// This is the beginning of the binary tree of widgets
@@ -16,6 +16,12 @@ 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
+
func main() {
myGui = gui.New().Default()
// myGui.LoadToolkit("nocui")
@@ -40,38 +46,45 @@ func helloworld() {
grid.NewButton("show basic window", func() {
basicWindow.Toggle()
})
- grid.NewLabel("apple")
+ grid.NewLabel("a label")
- dd := grid.NewDropdown().SetProgName("COMPUTERS")
- dd.AddText("Atari 500")
- dd.AddText("Beagleboard")
- dd.AddText("Unmatched Rev B")
- dd.AddText("asldjf")
- dd.AddText("asdjf")
- dd.AddText("a1jf")
- dd.AddText("jf")
- dd.SetText("Beagleboard")
+ 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")
- cb := grid.NewCombobox().SetProgName("COLORS")
- cb.AddText("Cyan")
- cb.AddText("Magenta")
- cb.AddText("Yellow")
- cb.SetText("orange")
+ 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("query")
+ queryGroup := box.NewGroup("interact")
queryGroup.NewButton("Which Computer?", func() {
- tmp := dd.String()
+ tmp := computers.String()
log.Println("computer =", tmp)
- for i, s := range dd.Strings() {
+ for i, s := range computers.Strings() {
log.Println("has option", i, s)
}
})
queryGroup.NewButton("Which Color?", func() {
- tmp := cb.String()
+ tmp := colors.String()
log.Println("color =", tmp)
})
+
+ queryGroup.NewButton("Show apple", func() {
+ apple.Show()
+ })
+ queryGroup.NewButton("Hide apple", func() {
+ apple.Hide()
+ })
}