toggle the basic window on and off
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
05311315ce
commit
cdeb6042fc
|
@ -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
|
||||
}
|
||||
|
|
7
main.go
7
main.go
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in New Issue