From 5e505b4f7ba2f0da11695fdb9a3c483548b79a89 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 2 Jun 2019 19:49:17 -0700 Subject: see if an interface can store the outside values also finally fixed the splash area logic Signed-off-by: Jeff Carr --- button.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'button.go') diff --git a/button.go b/button.go index 087d768..0e23991 100644 --- a/button.go +++ b/button.go @@ -73,6 +73,27 @@ func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM, name string, acti return newB } +func NewCreateButton(box *GuiBox, custom func(*GuiButton), name string, values interface {}) *GuiButton { + newUiB := ui.NewButton(name) + newUiB.OnClicked(defaultButtonClick) + + var newB *GuiButton + newB = new(GuiButton) + newB.B = newUiB + if (box.Window == nil) { + log.Println("CreateButton() box.Window == nil") + panic("crap") + } + newB.Box = box + newB.Custom = custom + newB.Values = values + + Data.AllButtons = append(Data.AllButtons, newB) + + box.UiBox.Append(newB.B, false) + return newB +} + func CreateFontButton(box *GuiBox, action string) *GuiButton { // create a 'fake' button entry for the mouse clicks var newGB GuiButton -- cgit v1.2.3