screwed up things with window display

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-21 01:57:04 -06:00
parent ff5892537c
commit 05634894d4
2 changed files with 24 additions and 21 deletions

View File

@ -2,6 +2,9 @@ all:
go build -v -x
./control-panel-vpn
goimports:
goimports -w *.go
redomod:
rm -f go.*
GO111MODULE= go mod init

42
main.go
View File

@ -1,19 +1,27 @@
// This is a simple example
package main
import (
"log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
"go.wit.com/apps/control-panel-dns/smartwindow"
import (
"go.wit.com/log"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
)
var myGui *gui.Node
var win *gadgets.BasicWindow
func main() {
myGui = gui.New().Default()
myGui.LoadToolkit("andlabs")
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
gui.Watchdog()
@ -21,9 +29,11 @@ func main() {
// This creates a window
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")
hellosmart()
})
@ -31,21 +41,11 @@ func helloworld() {
// This creates a window
func hellosmart() {
win := smartwindow.New()
win.SetParent(myGui)
win.InitWindow()
win.Title("helloworld golang wit/gui window")
win.Vertical()
win.SetDraw(smartDraw)
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
win.Make()
win.Draw()
win.Box().NewButton("hello", func () {
log.Println("smart")
})
}
func smartDraw(sw *smartwindow.SmartWindow) {
sw.Box().NewButton("hello", func () {
win.Box().NewButton("hello", func() {
log.Println("smart")
})
}