diff options
| author | Jeff Carr <[email protected]> | 2022-10-11 11:59:42 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-10-11 11:59:42 -0500 |
| commit | 3c899365154e48aefbc0b5ee48cd089f49339cb2 (patch) | |
| tree | 13f3c0aa281d17c55306ed2e0323aa5188087e04 /entry.go | |
| parent | 2294e22484be61a934ca8b523f4aeb40d20d6196 (diff) | |
| parent | 770fa06a18652b30db0cd4ee64e8e89d06d7de2e (diff) | |
Merge branch 'master' into develv0.3.1
Diffstat (limited to 'entry.go')
| -rw-r--r-- | entry.go | 42 |
1 files changed, 31 insertions, 11 deletions
@@ -10,29 +10,49 @@ import "github.com/davecgh/go-spew/spew" // functions for handling text entry boxes func NewLabel(box *GuiBox, text string) { - box.UiBox.Append(ui.NewLabel(text), false) + box.Append(ui.NewLabel(text), false) } -func GetText(box *GuiBox, name string) string { - if (box == nil) { - log.Println("gui.GetText() ERROR box == nil") - return "" - } - if (box.Window.EntryMap == nil) { +func (n *Node) NewLabel(text string) *Node { + // make new node here + // n.Append(ui.NewLabel(text), false) + newNode := makeNode(n, text, 333, 334) + newNode.Dump() + // panic("node.NewLabel()") + + n.Append(newNode) + return newNode +} + +func (b *GuiBox) GetText(name string) string { + if (b.Window.EntryMap == nil) { log.Println("gui.GetText() ERROR b.Box.Window.EntryMap == nil") return "" } - spew.Dump(box.Window.EntryMap) - if (box.Window.EntryMap[name] == nil) { + spew.Dump(b.Window.EntryMap) + if (b.Window.EntryMap[name] == nil) { log.Println("gui.GetText() ERROR box.Window.EntryMap[", name, "] == nil ") return "" } - e := box.Window.EntryMap[name] + e := b.Window.EntryMap[name] log.Println("gui.GetText() box.Window.EntryMap[", name, "] = ", e.UiEntry.Text()) log.Println("gui.GetText() END") return e.UiEntry.Text() } +func (n *Node) SetText(value string) error { + log.Println("gui.SetText() value =", value) + if (n.uiText != nil) { + n.uiText.SetText(value) + return nil + } + if (n.uiButton != nil) { + n.uiButton.SetText(value) + return nil + } + return nil +} + func SetText(box *GuiBox, name string, value string) error { if (box == nil) { return fmt.Errorf("gui.SetText() ERROR box == nil") @@ -42,7 +62,7 @@ func SetText(box *GuiBox, name string, value string) error { } spew.Dump(box.Window.EntryMap) if (box.Window.EntryMap[name] == nil) { - return fmt.Errorf("gui.SetText() ERROR box.Window.EntryMap[", name, "] == nil ") + return fmt.Errorf("gui.SetText() ERROR box.Window.EntryMap[" + name + "] == nil ") } e := box.Window.EntryMap[name] log.Println("gui.SetText() box.Window.EntryMap[", name, "] = ", e.UiEntry.Text()) |
