From c15c731e7f7746dc5cd85cde4650a4e44a4837c7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 30 May 2019 11:41:23 -0700 Subject: change CreateButton to rerturn *GuiButton Signed-off-by: Jeff Carr --- gui.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gui.go') diff --git a/gui.go b/gui.go index 163e58c..9d3acec 100644 --- a/gui.go +++ b/gui.go @@ -90,8 +90,10 @@ func AddTableTab(wm *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount i hbox := ui.NewHorizontalBox() hbox.SetPadded(true) - hbox.Append(CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil), false) - hbox.Append(CreateButton(wm, account, nil, "Close", "CLOSE", nil), false) + a := CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil) + hbox.Append(a.B, false) + b := CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil) + hbox.Append(b.B, false) vbox.Append(hbox, false) @@ -210,11 +212,12 @@ func AddButton(b *GuiButton, name string) *ui.Button { } func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM, - name string, action string, custom func(*GuiButton)) *ui.Button { + name string, action string, custom func(*GuiButton)) *GuiButton { newUiB := ui.NewButton(name) newUiB.OnClicked(defaultButtonClick) - var newB GuiButton + var newB *GuiButton + newB = new(GuiButton) newB.B = newUiB newB.T = wm.T newB.Account = a @@ -222,9 +225,9 @@ 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 newUiB + return newB } func CreateFontButton(wm *GuiWindow, action string) *GuiButton { -- cgit v1.2.3