screwed up things with window display
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
ff5892537c
commit
05634894d4
3
Makefile
3
Makefile
|
@ -2,6 +2,9 @@ all:
|
||||||
go build -v -x
|
go build -v -x
|
||||||
./control-panel-vpn
|
./control-panel-vpn
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
goimports -w *.go
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
|
|
42
main.go
42
main.go
|
@ -1,19 +1,27 @@
|
||||||
// This is a simple example
|
// This is a simple example
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/apps/control-panel-dns/smartwindow"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
|
||||||
|
var win *gadgets.BasicWindow
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
myGui = gui.New().Default()
|
myGui = gui.New().Default()
|
||||||
|
myGui.LoadToolkit("andlabs")
|
||||||
helloworld()
|
helloworld()
|
||||||
|
log.Sleep(1)
|
||||||
|
win.Toggle()
|
||||||
|
log.Sleep(1)
|
||||||
|
win.Toggle()
|
||||||
|
log.Sleep(1)
|
||||||
|
win.Toggle()
|
||||||
|
|
||||||
// This is just a optional goroutine to watch that things are alive
|
// This is just a optional goroutine to watch that things are alive
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
|
@ -21,9 +29,11 @@ func main() {
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
func helloworld() {
|
func helloworld() {
|
||||||
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
win = gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
||||||
|
win.Make()
|
||||||
|
win.Draw()
|
||||||
|
|
||||||
win.Box().NewButton("hello", func () {
|
win.Box().NewButton("hello", func() {
|
||||||
log.Println("world")
|
log.Println("world")
|
||||||
hellosmart()
|
hellosmart()
|
||||||
})
|
})
|
||||||
|
@ -31,21 +41,11 @@ func helloworld() {
|
||||||
|
|
||||||
// This creates a window
|
// This creates a window
|
||||||
func hellosmart() {
|
func hellosmart() {
|
||||||
win := smartwindow.New()
|
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
||||||
win.SetParent(myGui)
|
|
||||||
win.InitWindow()
|
|
||||||
win.Title("helloworld golang wit/gui window")
|
|
||||||
win.Vertical()
|
|
||||||
win.SetDraw(smartDraw)
|
|
||||||
win.Make()
|
win.Make()
|
||||||
|
win.Draw()
|
||||||
|
|
||||||
win.Box().NewButton("hello", func () {
|
win.Box().NewButton("hello", func() {
|
||||||
log.Println("smart")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func smartDraw(sw *smartwindow.SmartWindow) {
|
|
||||||
sw.Box().NewButton("hello", func () {
|
|
||||||
log.Println("smart")
|
log.Println("smart")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue