From 41e9f9578942bb62916eeca7dbfc376f5ec30cff Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 22 May 2019 17:06:33 -0700 Subject: [PATCH] makes the main window 'tabbed' Signed-off-by: Jeff Carr --- splash/splash.go | 4 +++- test2/main.go | 32 +++++++++++++++++++------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/splash/splash.go b/splash/splash.go index cdd43c7..2e9e1ee 100644 --- a/splash/splash.go +++ b/splash/splash.go @@ -61,7 +61,9 @@ func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.B okButton := gui.CreateButton("OK", "CLOSE", custom) newbox.Append(okButton, false) - vbox.Append(newbox, true) + if (vbox != nil) { + vbox.Append(newbox, true) + } return newbox } diff --git a/test2/main.go b/test2/main.go index 0187f02..a2ea953 100644 --- a/test2/main.go +++ b/test2/main.go @@ -10,9 +10,10 @@ import "git.wit.com/wit/cloud-control-panel/splash" import "git.wit.com/wit/cloud-control-panel/account1" // import "git.wit.com/wit/cloud-control-panel/account2" -import "github.com/davecgh/go-spew/spew" +// import "github.com/davecgh/go-spew/spew" var cloudWindow *ui.Window +var cloudTab *ui.Tab var cloudBox *ui.Box var smallBox *ui.Box var state string @@ -37,11 +38,14 @@ func main() { // ui.Main(account2.AddAccountWindow) } -func buttonClick(i int) { - log.Println("buttonClick() i =", i) +func buttonClick(i int, s string) { + log.Println("buttonClick() i, s =", i, s) } func watchGUI() { + log.Println("Sleep(2000)") + time.Sleep(2000 * time.Millisecond) + for { log.Println("Sleep()") time.Sleep(200 * time.Millisecond) @@ -81,18 +85,20 @@ func makeCloudWindow() { return true }) - cloudBox = ui.NewVerticalBox() - cloudBox.SetPadded(true) - cloudWindow.SetChild(cloudBox) +// cloudBox = ui.NewVerticalBox() +// cloudBox.SetPadded(true) +// cloudWindow.SetChild(cloudBox) +// cloudWindow.SetMargined(true) + + tab := ui.NewTab() + cloudWindow.SetChild(tab) cloudWindow.SetMargined(true) - // splash.ShowSplashBox(cloudBox, nil) + cloudBox = splash.ShowSplashBox(nil, nil, buttonClick) + + tab.Append("WIT Splash", cloudBox) + tab.SetMargined(0, true) - // This displays the window cloudWindow.Show() - log.Println("cloudBox:") - log.Println("cloudBox:") - log.Println("cloudBox:") - spew.Dump(cloudBox) - state = "splash" + state = "done" }