change to pointers correctly

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-30 11:56:34 -07:00
parent 403e7d089c
commit 00d0d1c5d0
5 changed files with 19 additions and 17 deletions

View File

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

View File

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

14
gui.go
View File

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

View File

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

View File

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