From 00d0d1c5d0177fe9da4495195b5ea5ff1fa67f11 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 May 2019 11:56:34 -0700 Subject: [PATCH] change to pointers correctly Signed-off-by: Jeff Carr --- addAccount.go | 14 ++++++++------ area.go | 4 ++-- gui.go | 14 +++++++------- mainCloudBox.go | 2 +- structs.go | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/addAccount.go b/addAccount.go index 418534d..41d2b47 100644 --- a/addAccount.go +++ b/addAccount.go @@ -40,15 +40,17 @@ func AddAccountQuestionBox(wm *GuiWindow) *ui.Box { hbox.Append(ui.NewLabel("Enter your Subdomain or"), false) - generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain) - hbox.Append(generate.B, false) + button1 := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain) + button1.Box = gb + hbox.Append(button1.B, false) AddEntry(gb, "SUBDOMAIN") vbox.Append(ui.NewHorizontalSeparator(), false) - okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain) - vbox.Append(okButton.B, false) + button2 := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain) + button2.Box = gb + vbox.Append(button2.B, false) return vbox } @@ -73,10 +75,10 @@ func generateSubdomain(b *GuiButton) { } func addSubdomain(b *GuiButton) { - log.Println("generateSubdomain START") + log.Println("addSubdomain START") // sub := subdomain.Text() // log.Println("generateSubdomain subdomain =", sub) - log.Println("generateSubdomain END") + log.Println("addSubdomain END") } func AddAccountBox(wm *GuiWindow) *ui.Box { diff --git a/area.go b/area.go index ccc7877..1efd5c4 100644 --- a/area.go +++ b/area.go @@ -12,9 +12,9 @@ func findFB(button *GuiButton) *GuiButton { var a *GuiButton for key, foo := range Data.AllButtons { log.Println("findFB() Data.AllButtons key, foo=", key, foo) - if &foo == button { + if foo == button { log.Println("findFB() FOUND BUTTON key, foo=", key, foo) - a = &foo + a = foo } } return a diff --git a/gui.go b/gui.go index 9d3acec..f9b6875 100644 --- a/gui.go +++ b/gui.go @@ -185,13 +185,13 @@ func defaultButtonClick(button *ui.Button) { log.Println("\tdefaultButtonClick() Data.AllButtons[key].Action =", Data.AllButtons[key].Action) if Data.AllButtons[key].custom != nil { log.Println("\tdefaultButtonClick() DOING CUSTOM FUNCTION") - var tmp GuiButton + var tmp *GuiButton tmp = Data.AllButtons[key] // spew.Dump(tmp) - Data.AllButtons[key].custom(&tmp) + Data.AllButtons[key].custom(tmp) return } - mouseClick(&Data.AllButtons[key]) + mouseClick(Data.AllButtons[key]) return } } @@ -207,7 +207,7 @@ func AddButton(b *GuiButton, name string) *ui.Button { newB.OnClicked(defaultButtonClick) b.B = newB - Data.AllButtons = append(Data.AllButtons, *b) + Data.AllButtons = append(Data.AllButtons, b) return newB } @@ -225,7 +225,7 @@ func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM, newB.WM = wm newB.Action = action newB.custom = custom - Data.AllButtons = append(Data.AllButtons, *newB) + Data.AllButtons = append(Data.AllButtons, newB) return newB } @@ -238,10 +238,10 @@ func CreateFontButton(wm *GuiWindow, action string) *GuiButton { newBM.Action = action newBM.FB = newB newBM.AH = wm.AH - Data.AllButtons = append(Data.AllButtons, newBM) + Data.AllButtons = append(Data.AllButtons, &newBM) newB.OnChanged(func (*ui.FontButton) { - log.Println("FontButton.OnChanged() START mouseClick(&newBM)", &newBM) + log.Println("FontButton.OnChanged() START mouseClick(&newBM)", newBM) mouseClick(&newBM) }) return &newBM diff --git a/mainCloudBox.go b/mainCloudBox.go index 47c5202..9d11bf7 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -264,7 +264,7 @@ func InitWindow(wm *GuiWindow) { newBM.Action = "QUIT" newBM.W = wm.W newBM.WM = wm - Data.AllButtons = append(Data.AllButtons, newBM) + Data.AllButtons = append(Data.AllButtons, &newBM) wm.W.OnClosing(func(*ui.Window) bool { log.Println("InitWindow() OnClosing() THIS WINDOW IS CLOSING wm=", wm) diff --git a/structs.go b/structs.go index a930047..ebca64d 100644 --- a/structs.go +++ b/structs.go @@ -41,7 +41,7 @@ type GuiData struct { // A map of all buttons everywhere on all // windows, all tabs, across all goroutines // This is "GLOBAL" - AllButtons []GuiButton + AllButtons []*GuiButton ButtonMap map[*GuiButton][]func (*GuiButton) // A map of all the entry boxes