NODE: walking

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-31 12:20:20 -05:00
parent c80f805bff
commit f72c88dafe
2 changed files with 15 additions and 2 deletions

View File

@ -40,6 +40,19 @@ func (b *GuiBox) GetText(name string) string {
return e.UiEntry.Text() 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 { func SetText(box *GuiBox, name string, value string) error {
if (box == nil) { if (box == nil) {
return fmt.Errorf("gui.SetText() ERROR box == nil") return fmt.Errorf("gui.SetText() ERROR box == nil")

View File

@ -77,9 +77,9 @@ func makeNode(parent *Node, title string, x int, y int) *Node {
// panic("gui.makeNode() after NodeMap()") // panic("gui.makeNode() after NodeMap()")
return &node return &node
} else { } else {
panic("gui.makeNode() before Append()") // panic("gui.makeNode() before Append()")
parent.Append(&node) parent.Append(&node)
panic("gui.makeNode() after Append()") // panic("gui.makeNode() after Append()")
} }
node.parent = parent node.parent = parent
return &node return &node