summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-29 11:10:12 -0700
committerJeff Carr <[email protected]>2019-05-29 11:10:12 -0700
commitec50a45351a5bd38009e2b2db69121b86fd15fa7 (patch)
tree34ae38520343efcfd357bda5578dfffbb9309d71
parent5a24461b59b49f622283951e1891559f6323a42d (diff)
correctly dereference the AreaHandler
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--area.go28
-rw-r--r--splash.go5
2 files changed, 16 insertions, 17 deletions
diff --git a/area.go b/area.go
index 62058d2..73279aa 100644
--- a/area.go
+++ b/area.go
@@ -20,12 +20,11 @@ func findFB(button *ButtonMap) *ButtonMap {
return a
}
-func makeSplashArea() *AreaHandler {
+func makeSplashArea(ah *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
+ ah.FontButton = newB.FB
time.Sleep(200 * time.Millisecond)
tmp := findFB(newB)
@@ -39,30 +38,29 @@ func makeSplashArea() *AreaHandler {
tmp = findFB(newB)
log.Println("makeSplashArea() tmp =", tmp, "newB", newB)
- Data.AllButtons[1].AH = myAH
+ Data.AllButtons[1].AH = ah
time.Sleep(200 * time.Millisecond)
tmp = findFB(newB)
log.Println("makeSplashArea() tmp =", tmp, "newB", newB)
- // log.Println("makeSplashArea() ah =", myAH)
- log.Println("makeSplashArea() ah.FontButton =", myAH.FontButton)
+ // log.Println("makeSplashArea() ah =", ah)
+ log.Println("makeSplashArea() ah.FontButton =", ah.FontButton)
// DefaultFont: ah.FontButton.Font(),
- myAH.Attrstr = makeAttributedString()
- myAH.Area = ui.NewArea(myAH)
- newB.A = myAH.Area
- Data.AllButtons[1].A = myAH.Area
- myAH.FontButton = Data.AllButtons[1].FB
- myAH.Button = &Data.AllButtons[1]
+ ah.Attrstr = makeAttributedString()
+ ah.Area = ui.NewArea(ah)
+ newB.A = ah.Area
+ Data.AllButtons[1].A = ah.Area
+ ah.FontButton = Data.AllButtons[1].FB
+ ah.Button = &Data.AllButtons[1]
if (Data.Debug) {
- spew.Dump(myAH.Area)
+ spew.Dump(ah.Area)
log.Println("DEBUGGING", Data.Debug)
} else {
- log.Println("NOT DEBUGGING AREA mhAH.Button =", myAH.Button)
+ log.Println("NOT DEBUGGING AREA mhAH.Button =", ah.Button)
}
- return myAH
}
func appendWithAttributes(newText *ui.AttributedString, what string, attrs ...ui.Attribute) {
diff --git a/splash.go b/splash.go
index 8558beb..96a360b 100644
--- a/splash.go
+++ b/splash.go
@@ -14,12 +14,13 @@ func ShowSplashBox() *ui.Box {
newbox := ui.NewVerticalBox()
newbox.SetPadded(true)
+ // initialize the AreaHandler{}
myAH = new(AreaHandler)
newText := makeAttributedString()
myAH.Attrstr = newText
- newAH := makeSplashArea()
+ makeSplashArea(myAH)
- newbox.Append(newAH.Area, true)
+ newbox.Append(myAH.Area, true)
if runtime.GOOS == "linux" {
newbox.Append(ui.NewLabel("OS: Linux"), false)