more tests

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-13 13:28:13 -07:00
parent 602dd0de2d
commit 22760127b9
3 changed files with 14 additions and 12 deletions

15
area.go
View File

@ -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)
}

View File

@ -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

View File

@ -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