summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--new-structs.go13
-rw-r--r--structs.go9
-rw-r--r--window-debug.go17
-rw-r--r--window.go4
4 files changed, 34 insertions, 9 deletions
diff --git a/new-structs.go b/new-structs.go
index ffe83d4..ffc90b9 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -70,7 +70,11 @@ func (n *Node) Dump() {
log.Println("gui.Node.Dump() Width = ", n.Width)
log.Println("gui.Node.Dump() Height = ", n.Height)
- log.Println("gui.Node.Dump() parent = ", n.parent)
+ if (n.parent == nil) {
+ log.Println("gui.Node.Dump() parent = nil")
+ } else {
+ log.Println("gui.Node.Dump() parent = ", n.parent.id)
+ }
log.Println("gui.Node.Dump() children = ", n.children)
log.Println("gui.Node.Dump() window = ", n.window)
@@ -204,7 +208,7 @@ func findByName(node *Node, name string) *Node {
return nil
}
-func (parent *Node) AddTab(title string) *Node {
+func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
if parent.uiWindow == nil {
parent.Dump()
panic("gui.AddTab() ERROR ui.Window == nil")
@@ -226,7 +230,10 @@ func (parent *Node) AddTab(title string) *Node {
tab := parent.uiTab
parent.uiWindow.SetMargined(true)
- tab.Append(title, initBlankWindow())
+ if (uiC == nil) {
+ uiC = parent.initBlankWindow()
+ }
+ tab.Append(title, uiC)
tab.SetMargined(0, true)
newNode := parent.makeNode(title, 555, 600 + Config.counter)
diff --git a/structs.go b/structs.go
index d09efb8..f15a0e0 100644
--- a/structs.go
+++ b/structs.go
@@ -200,6 +200,7 @@ func (s *GuiBox) AddTab(title string, custom ui.Control) *ui.Tab {
return tab
}
+/*
func (s GuiBox) AddBoxTab(title string) *GuiBox {
uiTab := s.AddTab(title, initBlankWindow())
tabSetMargined(uiTab)
@@ -209,10 +210,12 @@ func (s GuiBox) AddBoxTab(title string) *GuiBox {
box.Window.UiTab = uiTab
return box
}
+*/
-func (s GuiBox) AddDemoTab(title string) {
- uiTab := s.AddTab(title, makeWindowTemplate())
- tabSetMargined(uiTab)
+func (n *Node) AddDemoTab(title string) {
+ newNode := n.AddTab(title, makeWindowTemplate())
+ newNode.Dump()
+ tabSetMargined(newNode.uiTab)
}
func (s GuiBox) AddDebugTab(title string) {
diff --git a/window-debug.go b/window-debug.go
index c440e03..de4b31b 100644
--- a/window-debug.go
+++ b/window-debug.go
@@ -187,6 +187,17 @@ func makeWindowDebug() ui.Control {
Data.ListChildren(true)
})
+ n1 = addButton(vbox, "Node.Dump()")
+ n1.OnClicked(func(*ui.Button) {
+ y := nodeCombo.Selected()
+ log.Println("y =", y)
+ log.Println("nodeNames[y] =", nodeNames[y])
+ node := Data.findId(nodeNames[y])
+ if (node != nil) {
+ node.Dump()
+ }
+ })
+
n1 = addButton(vbox, "Node.ListChildren(false)")
n1.OnClicked(func(*ui.Button) {
y := nodeCombo.Selected()
@@ -269,7 +280,10 @@ func FindBox(s string) *GuiBox {
}
func dumpBox(s string) {
- for name, window := range Data.WindowMap {
+ var name string
+ var window *GuiWindow
+
+ for name, window = range Data.WindowMap {
if name != s {
continue
}
@@ -286,6 +300,7 @@ func dumpBox(s string) {
log.Println("gui.dumpBox() BoxMap START")
for name, abox := range window.BoxMap {
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
+ abox.Dump()
if name == "MAINBOX" {
if Config.Debug {
scs := spew.ConfigState{MaxDepth: 1}
diff --git a/window.go b/window.go
index 2f7c58a..3543b2b 100644
--- a/window.go
+++ b/window.go
@@ -214,7 +214,7 @@ func CreateWindow(title string, tabname string, x int, y int, custom func() ui.C
log.Println("SERIOUS ERROR n.box == nil in CreateWindow()")
log.Println("SERIOUS ERROR n.box == nil in CreateWindow()")
}
- n.AddTab(title)
+ n.AddTab(title, custom())
// TODO: run custom() here // Oct 9
return n
}
@@ -319,7 +319,7 @@ func CreateBlankWindow(title string, x int, y int) *Node {
return node
}
-func initBlankWindow() ui.Control {
+func (n *Node) initBlankWindow() ui.Control {
hbox := ui.NewHorizontalBox()
hbox.SetPadded(true)