diff options
| author | Jeff Carr <[email protected]> | 2021-10-07 06:19:35 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-07 06:19:35 -0500 |
| commit | 54cf41663c2d94182370a2a4b14526f35c601131 (patch) | |
| tree | 9f05b767065f636d321bb1d413155dfea3318ccc /new-structs.go | |
| parent | 3eac6beec4c3809b4696d63a252a34a6c6dc8ae1 (diff) | |
NODE: continued work on implementing a node tree
Diffstat (limited to 'new-structs.go')
| -rw-r--r-- | new-structs.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/new-structs.go b/new-structs.go index df25cae..d6ff409 100644 --- a/new-structs.go +++ b/new-structs.go @@ -16,12 +16,13 @@ type Node struct { Height int children []*Node + box *GuiBox control *ui.Control window *ui.Window } -func (n Node) SetName(name string) { +func (n *Node) SetName(name string) { // n.uiType.SetName(name) if (n.window != nil) { log.Println("node is a window. setting title =", name) @@ -32,15 +33,30 @@ func (n Node) SetName(name string) { return } -func (n Node) Append(child Node) { +func (n *Node) FindWindowBox() *GuiBox { + if (n.box == nil) { + log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()") + log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()") + log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()") + log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()") + } + return n.box +} + +func (n *Node) Append(child Node) { // if (n.UiBox == nil) { // return // } // n.uiType.Append(child, x) } +func (n *Node) List() { + findByIdDFS(n, "test") +} func findByIdDFS(node *Node, id string) *Node { + log.Println("findByIdDFS()", id, node) if node.id == id { + log.Println("Found node id =", id, node) return node } |
