start handling 'Guiwindow' correctly

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-01 13:41:45 -07:00
parent 20a402f106
commit a941c5a0f1
4 changed files with 15 additions and 11 deletions

17
area.go
View File

@ -17,18 +17,19 @@ func makeSplashArea(gb *GuiBox, newText *ui.AttributedString) {
newB.Box = gb
newB.GW = gb.Window
gw := gb.Window
// initialize the GuiArea{}
gb.Area = new(GuiArea)
gb.Area.Button = newB
gb.Area.Box = gb
gb.Area.UiAttrstr = newText
gb.Area.UiArea = ui.NewArea(gb.Area)
gw.Area = new(GuiArea)
gw.Area.Button = newB
gw.Area.Box = gb
gw.Area.UiAttrstr = newText
gw.Area.UiArea = ui.NewArea(gw.Area)
if (Data.Debug) {
spew.Dump(gb.Area.UiArea)
spew.Dump(gw.Area.UiArea)
log.Println("DEBUGGING", Data.Debug)
} else {
log.Println("NOT DEBUGGING AREA mhAH.Button =", gb.Area.Button)
log.Println("NOT DEBUGGING AREA mhAH.Button =", gw.Area.Button)
}
}
@ -128,7 +129,7 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox {
gw.BoxMap["Splash"] = gb
makeSplashArea(gb, newText)
newbox.Append(gb.Area.UiArea, true)
newbox.Append(gw.Area.UiArea, true)
return gb
}

2
gui.go
View File

@ -197,7 +197,7 @@ func CreateFontButton(box *GuiBox, action string) *GuiButton {
newGB.Action = action
newGB.FB = ui.NewFontButton()
newGB.Box = box
newGB.Area = box.Area
newGB.Area = box.Window.Area
Data.AllButtons = append(Data.AllButtons, &newGB)
newGB.FB.OnChanged(func (*ui.FontButton) {

View File

@ -36,10 +36,14 @@ func GuiInit() {
})
}
func ShowMainTab(gw *GuiWindow) *GuiBox {
func AddMainTab(gw *GuiWindow) *GuiBox {
log.Println("ShowMainTab() gw =", gw)
log.Println("ShowMainTab() gw.UiTab =", gw.UiTab)
newWindow := new(GuiWindow)
newWindow.UiWindow = gw.UiWindow
Data.Windows = append(Data.Windows, newWindow)
var box *GuiBox
box = new(GuiBox)
box.Window = gw

View File

@ -122,7 +122,6 @@ type GuiButton struct {
type GuiBox struct {
Window *GuiWindow
EntryMap map[string]*GuiEntry
Area *GuiArea
// andlabs/ui abstraction mapping
UiBox *ui.Box