diff --git a/area.go b/area.go index 1cb8e67..62058d2 100644 --- a/area.go +++ b/area.go @@ -23,6 +23,7 @@ func findFB(button *ButtonMap) *ButtonMap { func makeSplashArea() *AreaHandler { // make this button just to get the default font (but don't display the button) // There should be another way to do this (?) + myAH = new(AreaHandler) newB := CreateFontButton("AREA") myAH.FontButton = newB.FB @@ -38,7 +39,7 @@ func makeSplashArea() *AreaHandler { tmp = findFB(newB) log.Println("makeSplashArea() tmp =", tmp, "newB", newB) - Data.AllButtons[1].AH = &myAH + Data.AllButtons[1].AH = myAH time.Sleep(200 * time.Millisecond) tmp = findFB(newB) @@ -61,7 +62,7 @@ func makeSplashArea() *AreaHandler { } else { log.Println("NOT DEBUGGING AREA mhAH.Button =", myAH.Button) } - return &myAH + return myAH } func appendWithAttributes(newText *ui.AttributedString, what string, attrs ...ui.Attribute) { @@ -94,8 +95,9 @@ func (ah AreaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) { } if (me.Up == 1) { log.Println("GOT MOUSE UP") - log.Println("GOT MOUSE UP") - log.Println("GOT MOUSE UP") + // log.Println("GOT MOUSE UP ah", ah) + log.Println("GOT MOUSE UP ah.FontButton =", ah.FontButton) + log.Println("GOT MOUSE UP ah.Button =", ah.Button) mouseClick(ah.Button) } } diff --git a/gui.go b/gui.go index 58a9bd2..407984f 100644 --- a/gui.go +++ b/gui.go @@ -232,11 +232,12 @@ func CreateFontButton(action string) *ButtonMap { var newBM ButtonMap newBM.Action = action newBM.FB = newB - newBM.AH = &myAH + newBM.AH = myAH Data.AllButtons = append(Data.AllButtons, newBM) newB.OnChanged(func (*ui.FontButton) { - mouseClick(&newBM) + log.Println("FontButton.OnChanged() START mouseClick(&newBM)", &newBM) + // mouseClick(&newBM) }) return &newBM } diff --git a/splash.go b/splash.go index 194e556..8558beb 100644 --- a/splash.go +++ b/splash.go @@ -14,6 +14,7 @@ func ShowSplashBox() *ui.Box { newbox := ui.NewVerticalBox() newbox.SetPadded(true) + myAH = new(AreaHandler) newText := makeAttributedString() myAH.Attrstr = newText newAH := makeSplashArea() diff --git a/structs.go b/structs.go index d2d85fb..6b0ee3c 100644 --- a/structs.go +++ b/structs.go @@ -13,7 +13,7 @@ import pb "git.wit.com/wit/witProtobuf" // be the safe way to interact with the GUI // var Data GuiDataStructure -var myAH AreaHandler +var myAH *AreaHandler type GuiDataStructure struct { State string @@ -119,7 +119,7 @@ type AreaHandler struct{ Attrstr *ui.AttributedString Area *ui.Area FontButton *ui.FontButton - FB func () *ButtonMap +// FB func () *ButtonMap } // AREA STRUCTURES END