diff options
| author | Jeff Carr <[email protected]> | 2021-10-28 19:47:49 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-28 19:47:49 -0500 |
| commit | 5a838262bdc72e51351d0d81efcd9b2825e5e525 (patch) | |
| tree | 49a2722c1d79c8d59f736fd13012750e56dea602 /button.go | |
| parent | 5cff6a1acef806e263191fcb58bd68ac4a7287ea (diff) | |
BOX: start node.button() funcs in the rabbit hole
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'button.go')
| -rw-r--r-- | button.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -50,6 +50,32 @@ func guiButtonClick(button *GuiButton) { } } +func (n *Node) CreateButton(custom func(*GuiButton), name string, values interface {}) *Node { + newNode := n.AddBox(Xaxis, "test") + box := newNode.FindBox() + if (box == nil) { + panic("node.CreateButton().FindBox() == nil") + } + newUiB := ui.NewButton(name) + newUiB.OnClicked(defaultButtonClick) + + var newB *GuiButton + newB = new(GuiButton) + newB.B = newUiB + if (box.UiBox == nil) { + log.Println("CreateButton() box.Window == nil") + // ErrorWindow(box.Window, "Login Failed", msg) // can't even do this + panic("maybe print an error and return nil? or make a fake button?") + } + newB.Box = box + newB.Custom = custom + newB.Values = values + + Data.AllButtons = append(Data.AllButtons, newB) + + box.Append(newB.B, false) + return newNode +} func CreateButton(box *GuiBox, custom func(*GuiButton), name string, values interface {}) *GuiButton { newUiB := ui.NewButton(name) newUiB.OnClicked(defaultButtonClick) |
