diff options
| author | Jeff Carr <[email protected]> | 2024-01-28 02:44:59 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-28 02:44:59 -0600 |
| commit | 1f3d664dbdee1b567f5b40e06c63c07c4667d5f4 (patch) | |
| tree | 63c48627fbb9b96bc896393c432137715ccb1fc5 /widget.go | |
| parent | 4fbbd2cee13546dbe570509e2c2e0755225a1489 (diff) | |
tree starts to work. 'M' lists internal gocui tree
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'widget.go')
| -rw-r--r-- | widget.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -29,6 +29,21 @@ func initWidget(n *tree.Node) *guiWidget { w.heights = make(map[int]int) // how wide each column in the grid is } + p := n.Parent + if p == nil { + log.Log(ERROR, "parent == nil", w.String(), n.WidgetId, w.WidgetType) + return w + } + if p.TK == nil { + log.Log(ERROR, "parent.TK == nil", w.String(), n.WidgetId, w.WidgetType) + return w + } + + // set the parent and append to parent children + var ptk *guiWidget + ptk = p.TK.(*guiWidget) + w.parent = ptk + ptk.children = append(ptk.children, w) return w } |
