more experiments on stability
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b213a90e20
commit
d96a94e977
|
@ -7,6 +7,7 @@ example-UI-table/example-UI-table
|
||||||
example-dnssecsocket/example-dnssecsocket
|
example-dnssecsocket/example-dnssecsocket
|
||||||
example-table/example-table
|
example-table/example-table
|
||||||
example-aminal/example-aminal
|
example-aminal/example-aminal
|
||||||
|
example-multiple-windows/example-multiple-windows
|
||||||
|
|
||||||
test1/test1
|
test1/test1
|
||||||
test2/test2
|
test2/test2
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
run:
|
||||||
|
go build
|
||||||
|
./example-multiple-windows
|
|
@ -0,0 +1,117 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
// import "os"
|
||||||
|
import "log"
|
||||||
|
import "fmt"
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
import "git.wit.com/wit/gui"
|
||||||
|
import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
|
import "github.com/andlabs/ui"
|
||||||
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
var first *gui.WindowMap
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var c *pb.Config
|
||||||
|
c = pb.MakeDefaultConfig()
|
||||||
|
|
||||||
|
i := 1
|
||||||
|
|
||||||
|
c.Width = int32(400 + 50 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
|
first = StartNewWindow(c, true, "SPLASH")
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
c.Width = int32(400 + 50 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
|
StartNewWindow(c, false, "BLAH")
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
c.Width = int32(400 + 50 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
|
StartNewWindow(c, false, "BLAH")
|
||||||
|
|
||||||
|
for {
|
||||||
|
i += 1
|
||||||
|
c.Width = int32(400 + 50 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
|
StartNewWindow(c, false, "SPLASH")
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
c.Width = int32(400 + 50 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
|
StartNewWindow(c, false, "BLAH")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func StartNewWindow(c *pb.Config, bg bool, action string) *gui.WindowMap {
|
||||||
|
log.Println("InitNewWindow() Create a new window")
|
||||||
|
var newWindowMap *gui.WindowMap
|
||||||
|
newWindowMap = new(gui.WindowMap)
|
||||||
|
newWindowMap.C = c
|
||||||
|
|
||||||
|
/*
|
||||||
|
ui.OnShouldQuit(func() bool {
|
||||||
|
// mouseClick(&newBM)
|
||||||
|
ui.Quit()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
if (bg) {
|
||||||
|
log.Println("ShowWindow() IN NEW GOROUTINE")
|
||||||
|
go ui.Main(func() {
|
||||||
|
InitWindow(newWindowMap)
|
||||||
|
})
|
||||||
|
time.Sleep(2000 * time.Millisecond)
|
||||||
|
} else {
|
||||||
|
log.Println("ShowWindow() WAITING for ui.Main()")
|
||||||
|
ui.Main(func() {
|
||||||
|
InitWindow(newWindowMap)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return newWindowMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitWindow(wm *gui.WindowMap) {
|
||||||
|
log.Println("InitWindow() NEW WINDOW wm =", wm)
|
||||||
|
|
||||||
|
c := wm.C
|
||||||
|
wm.W = ui.NewWindow("", int(c.Width), int(c.Height), true)
|
||||||
|
// wm.W.SetBorderless(false)
|
||||||
|
|
||||||
|
blah := wm
|
||||||
|
wm.W.OnClosing(func(*ui.Window) bool {
|
||||||
|
log.Println("InitWindow() OnClosing() blah")
|
||||||
|
log.Println("InitWindow() OnClosing() blah")
|
||||||
|
log.Println("InitWindow() OnClosing() blah")
|
||||||
|
log.Println("InitWindow() OnClosing() blah")
|
||||||
|
spew.Dump(blah)
|
||||||
|
spew.Dump(wm)
|
||||||
|
wm.C = nil
|
||||||
|
log.Println("InitWindow() OnClosing() THIS WINDOW IS CLOSING wm=", wm)
|
||||||
|
spew.Dump(wm)
|
||||||
|
spew.Dump(wm.W)
|
||||||
|
// mouseClick(&newBM)
|
||||||
|
if (wm.W != nil) {
|
||||||
|
wm.W.Hide()
|
||||||
|
}
|
||||||
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
spew.Dump(wm)
|
||||||
|
// wm.W.Destroy()
|
||||||
|
ui.Quit()
|
||||||
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
// wm.W.SetChild(wm.T)
|
||||||
|
// wm.W.SetMargined(true)
|
||||||
|
|
||||||
|
log.Println("InitWindow() Show() wm.Action =", wm.Action)
|
||||||
|
wm.W.Show()
|
||||||
|
}
|
10
main.go
10
main.go
|
@ -105,8 +105,8 @@ func main() {
|
||||||
onExit(err)
|
onExit(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.Data.Width = int(config.Width)
|
// gui.Data.Width = int(config.Width)
|
||||||
gui.Data.Height = int(config.Height)
|
// gui.Data.Height = int(config.Height)
|
||||||
|
|
||||||
// use this to discover what the OS thinks it's hostname is
|
// use this to discover what the OS thinks it's hostname is
|
||||||
// seems to be cross platform (?)
|
// seems to be cross platform (?)
|
||||||
|
@ -145,12 +145,6 @@ func main() {
|
||||||
// make this the main loop in an attempt to figure out the crashes
|
// make this the main loop in an attempt to figure out the crashes
|
||||||
// do not change this until the GUI is stable
|
// do not change this until the GUI is stable
|
||||||
gui.StartNewWindow(config, false, "SPLASH")
|
gui.StartNewWindow(config, false, "SPLASH")
|
||||||
|
|
||||||
// gui.Data.Window1 = new(gui.WindowMap)
|
|
||||||
// gui.Data.Window1.AreaText = getSplashText()
|
|
||||||
// this crashes here. crazy!
|
|
||||||
// gui.Data.Window1.AreaText = getNEWTEXT()
|
|
||||||
// gui.GoMainWindow()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the handler for all mosue clicks (buttons, areas, etc))
|
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||||
|
|
|
@ -5,7 +5,6 @@ import "git.wit.com/wit/gui"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
|
||||||
func getSplashText() *ui.AttributedString {
|
func getSplashText() *ui.AttributedString {
|
||||||
var aText *ui.AttributedString
|
var aText *ui.AttributedString
|
||||||
aText = ui.NewAttributedString("Click to continue")
|
aText = ui.NewAttributedString("Click to continue")
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
import "log"
|
import "log"
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
@ -17,22 +18,26 @@ func main() {
|
||||||
|
|
||||||
gui.Data.MouseClick = mainMouseClick
|
gui.Data.MouseClick = mainMouseClick
|
||||||
|
|
||||||
i := 0
|
i := 1
|
||||||
|
|
||||||
gui.Data.Hostname = "splash " + string(i)
|
c.Width += int32(100 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
gui.StartNewWindow(c, true, "SPLASH")
|
gui.StartNewWindow(c, true, "SPLASH")
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
gui.Data.Hostname = "splash " + string(i)
|
c.Width += int32(100 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
gui.StartNewWindow(c, true, "BLAH")
|
gui.StartNewWindow(c, true, "BLAH")
|
||||||
|
|
||||||
for {
|
for {
|
||||||
i += 1
|
i += 1
|
||||||
gui.Data.Hostname = "splash " + string(i)
|
c.Width += int32(100 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
gui.StartNewWindow(c, false, "SPLASH")
|
gui.StartNewWindow(c, false, "SPLASH")
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
gui.Data.Hostname = "splash " + string(i)
|
c.Width += int32(100 * i)
|
||||||
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
||||||
gui.StartNewWindow(c, false, "BLAH")
|
gui.StartNewWindow(c, false, "BLAH")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue