From 22760127b93cc1e85fc88ad56343a79bd4504814 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 13 Jun 2019 13:28:13 -0700 Subject: [PATCH] more tests Signed-off-by: Jeff Carr --- area.go | 15 ++++++++------- structs.go | 2 +- window.go | 9 +++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/area.go b/area.go index 3c41f62..d170659 100644 --- a/area.go +++ b/area.go @@ -107,14 +107,16 @@ func (ah GuiArea) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) { return false } -func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiButton), name string) *GuiBox { +func ShowTextBox(box *GuiBox, newText *ui.AttributedString, custom func(*GuiButton), name string) { log.Println("ShowTextBox() START") + gw := box.Window if (gw == nil) { log.Println("ShowTextBox() ERROR gw = nil") - return nil + return } log.Println("ShowTextBox() START gw =", gw) + /* var newbox *GuiBox newbox = new(GuiBox) newbox.Window = gw @@ -124,11 +126,10 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiBu // TODO: allow padded & axis here hbox.SetPadded(true) + */ - add(gw.BoxMap["MAINBOX"], newbox) + // add(gw.BoxMap["MAINBOX"], newbox) - makeGenericArea(newbox, newText, custom) - newbox.UiBox.Append(newbox.Window.Area.UiArea, true) - - return newbox + makeGenericArea(box, newText, custom) + box.UiBox.Append(box.Window.Area.UiArea, true) } diff --git a/structs.go b/structs.go index 3455dc4..baf514a 100644 --- a/structs.go +++ b/structs.go @@ -67,7 +67,7 @@ type GuiWindow struct { TabNumber *int // the andlabs/ui tab index // the callback function to make the window contents - MakeWindow func(*GuiWindow) *GuiBox + MakeWindow func(*GuiBox) *GuiBox // the components of the window BoxMap map[string]*GuiBox diff --git a/window.go b/window.go index b4a1c8b..33e17cd 100644 --- a/window.go +++ b/window.go @@ -7,7 +7,7 @@ import "time" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -func StartNewWindow(bg bool, name string, axis int, callback func(*GuiWindow) *GuiBox) { +func StartNewWindow(bg bool, name string, axis int, callback func(*GuiBox) *GuiBox) { log.Println("StartNewWindow() Create a new window") var tmp GuiWindow tmp.MakeWindow = callback @@ -52,9 +52,8 @@ func initTabWindow(gw *GuiWindow) { DumpBoxes() // for {} box := InitWindow(gw, gw.Name, gw.Axis) + box = gw.MakeWindow(box) gw = box.Window - - box = gw.MakeWindow(gw) log.Println("initTabWindow() END box =", box) log.Println("initTabWindow() END gw =", gw) gw.UiWindow.Show() @@ -84,8 +83,10 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox { log.Println("InitGuiWindow() START") var newGuiWindow GuiWindow - newGuiWindow.Width = Config.Width newGuiWindow.Height = Config.Height + newGuiWindow.Width = Config.Width + newGuiWindow.Height = 600 + newGuiWindow.Width = 800 newGuiWindow.Axis = axis newGuiWindow.MakeWindow = gw.MakeWindow