diff options
| author | Jeff Carr <[email protected]> | 2024-01-19 13:03:59 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-19 13:03:59 -0600 |
| commit | 0e333cd78f4bdf69a77c2fcf0e17d5ceebff21e5 (patch) | |
| tree | 070878fc024ec3687758d146cee6e7dd7a3ce833 | |
| parent | 0c3ed55c33f1ce18c8d1797ade708b143589a8dc (diff) | |
hmmm
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | choices.go | 56 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | stateWindow.go | 5 |
4 files changed, 65 insertions, 6 deletions
@@ -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 diff --git a/choices.go b/choices.go new file mode 100644 index 0000000..2c9fcd2 --- /dev/null +++ b/choices.go @@ -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 +} @@ -27,7 +27,7 @@ func main() { // myGui.LoadToolkit("nocui") helloworld() - basicWindow = makebasicWindow() + // basicWindow = makebasicWindow() // go will sit here until the window exits gui.Watchdog() diff --git a/stateWindow.go b/stateWindow.go index 74954da..558a1e1 100644 --- a/stateWindow.go +++ b/stateWindow.go @@ -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 } |
