minor updates

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-03 23:17:13 -07:00
parent 5f65b2f5ed
commit fc6bde460c
1 changed files with 10 additions and 4 deletions

View File

@ -7,11 +7,12 @@ import "time"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow {
log.Println("InitGuiWindow() START")
var newGuiWindow GuiWindow
newGuiWindow.Width = Config.Width
newGuiWindow.Height = Config.Height
newGuiWindow.Name = name
newGuiWindow.MakeWindow = gw.MakeWindow
newGuiWindow.UiWindow = gw.UiWindow
newGuiWindow.UiTab = gw.UiTab
@ -20,6 +21,12 @@ func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
newGuiWindow.EntryMap["test"] = nil
Data.Windows = append(Data.Windows, &newGuiWindow)
if (Data.WindowMap == nil) {
log.Println("gui.InitGuiWindow() making the Data.WindowMap here")
Data.WindowMap = make(map[string]*GuiWindow)
}
Data.WindowMap[name] = &newGuiWindow
if (Data.buttonMap == nil) {
GuiInit()
}
@ -28,12 +35,11 @@ func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
}
func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
func StartNewWindow(bg bool, name string, callback func(*GuiWindow) *GuiBox) {
log.Println("StartNewWindow() Create a new window")
var junk GuiWindow
junk.MakeWindow = callback
// junk.Action = action
window := InitGuiWindow(action, &junk)
window := InitGuiWindow(name, &junk)
if (bg) {
log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()")
go ui.Main(func() {