diff options
| author | Jeff Carr <[email protected]> | 2021-10-31 03:50:22 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-31 03:50:22 -0500 |
| commit | e5638b8079728e66b09071ec8af1d2b423b9eb76 (patch) | |
| tree | 8c91e0984492b2abab1086870caddcecbbfb491a /new-structs.go | |
| parent | edceb19a33643419d0e367d36a7753fb68ede470 (diff) | |
NODE: add a button in the hole that doesn't use the other hole
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'new-structs.go')
| -rw-r--r-- | new-structs.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/new-structs.go b/new-structs.go index 5ef3309..915f881 100644 --- a/new-structs.go +++ b/new-structs.go @@ -3,6 +3,7 @@ package gui import ( "log" "fmt" + "reflect" // "github.com/davecgh/go-spew/spew" @@ -50,7 +51,8 @@ type Node struct { window *GuiWindow box *GuiBox - uiControl *ui.Control + uiControl *ui.Control + uiButton *ui.Button uiWindow *ui.Window uiTab *ui.Tab uiBox *ui.Box @@ -85,6 +87,7 @@ func (n *Node) Dump() { log.Println("gui.Node.Dump() uiTab = ", n.uiTab) log.Println("gui.Node.Dump() uiBox = ", n.uiBox) log.Println("gui.Node.Dump() uiControl = ", n.uiControl) + log.Println("gui.Node.Dump() uiButton = ", n.uiButton) if (n.id == "") { panic("gui.Node.Dump() id == nil") } @@ -120,6 +123,25 @@ func (n *Node) Append(child *Node) { // time.Sleep(3 * time.Second) } +func (n *Node) AppendButton(name string, custom func(*Node)) *Node { + if (n.uiBox == nil) { + log.Println("gui.Node.AppendButton() filed node.UiBox == nil") + return n + } + button := ui.NewButton(name) + log.Println("reflect.TypeOF(uiBox) =", reflect.TypeOf(n.uiBox)) + log.Println("reflect.TypeOF(uiButton) =", reflect.TypeOf(button)) + n.uiBox.Append(button, false) + n.uiButton = button + button.OnClicked(func(*ui.Button) { + log.Println("gui.AppendButton() Button Clicked. Running custom()") + custom(n) + }) + // panic("AppendButton") + // time.Sleep(3 * time.Second) + return n +} + func (n *Node) List() { findByIdDFS(n, "test") } |
