toggle the basic window on and off

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-18 21:20:07 -06:00
parent 05311315ce
commit cdeb6042fc
3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,5 @@
all: build
reset
./basicwindow
build:

View File

@ -2,19 +2,23 @@
package main
import (
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/lib/gadgets"
)
// This initializes the first window, a group and a button
func makebasicWindow() {
func makebasicWindow() *gadgets.BasicWindow {
log.Warn("start basicWindow")
basicWindow = gadgets.NewBasicWindow(myGui, "basic window test")
basicWindow.Make()
basicWindow.StandardExit()
basicWindow.StandardClose()
basicWindow.Custom = func () {
log.Warn("got to close")
}
box1 := basicWindow.Box()
group1 := box1.NewGroup("choices")
group1.NewButton("hello", func() {})
basicWindow.Draw()
// basicWindow.Draw()
return basicWindow
}

View File

@ -18,9 +18,10 @@ var basicWindow *gadgets.BasicWindow
func main() {
myGui = gui.New().Default()
myGui.LoadToolkit("nocui")
// myGui.LoadToolkit("nocui")
helloworld()
basicWindow = makebasicWindow()
// go will sit here until the window exits
gui.Watchdog()
@ -28,7 +29,7 @@ func main() {
// This initializes the first window and some widgets
func helloworld() {
mainWindow = myGui.NewWindow("hello world")
mainWindow = myGui.NewWindow("hello world").SetProgName("BASEWIN1")
box := mainWindow.NewBox("vbox", false)
group := box.NewGroup("choices")
@ -37,7 +38,7 @@ func helloworld() {
log.Println("world")
})
grid.NewButton("show basic window", func() {
makebasicWindow()
basicWindow.Toggle()
})
grid.NewLabel("apple")