From 23e471d9c1383acee57c4cf4b2ab48ca64d92595 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 25 Oct 2021 07:51:17 -0500 Subject: [PATCH] NODE: finally remove initBlankWindow() Signed-off-by: Jeff Carr --- gui-example/main.go | 1 + new-structs.go | 13 ++++++++++--- window.go | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gui-example/main.go b/gui-example/main.go index 722253a..e1caa6e 100644 --- a/gui-example/main.go +++ b/gui-example/main.go @@ -29,6 +29,7 @@ func initGUI() { node := gui.NewWindow() node.AddDemoTab("A Simple Tab Demo") + node.AddAndlabsUiDemoTab("A Simple andlabs/ui Tab Demo") } // This demonstrates how to properly interact with the GUI diff --git a/new-structs.go b/new-structs.go index d50de32..e86bb53 100644 --- a/new-structs.go +++ b/new-structs.go @@ -172,15 +172,19 @@ func (parent *Node) AddTabNode(title string, b *GuiBox) *Node { var newNode *Node // var newControl ui.Control + /* if (parent.box == nil) { // TODO: fix this to use a blank box - uiC := parent.initBlankWindow() - newNode.uiControl = &uiC + // uiC := parent.initBlankWindow() + hbox := ui.NewHorizontalBox() + hbox.SetPadded(true) + newNode.uiBox = hbox panic("node.AddTabNode() can not add a tab if the box == nil") } if (parent.uiTab == nil) { panic("node.AddTabNode() can not add a tab if parent.uiTab == nil") } + */ newNode = parent.makeNode(title, 444, 400 + Config.counter) newNode.uiTab = parent.uiTab @@ -206,6 +210,7 @@ func (parent *Node) AddTabNode(title string, b *GuiBox) *Node { } func (parent *Node) AddTab(title string, uiC ui.Control) *Node { + log.Println("gui.Node.AddTab() START name =", title) if parent.uiWindow == nil { parent.Dump() panic("gui.AddTab() ERROR ui.Window == nil") @@ -228,7 +233,9 @@ func (parent *Node) AddTab(title string, uiC ui.Control) *Node { parent.uiWindow.SetMargined(true) if (uiC == nil) { - uiC = parent.initBlankWindow() + hbox := ui.NewHorizontalBox() + hbox.SetPadded(true) + uiC = hbox } tab.Append(title, uiC) tab.SetMargined(0, true) diff --git a/window.go b/window.go index 1dadad7..73ccad3 100644 --- a/window.go +++ b/window.go @@ -341,12 +341,14 @@ func CreateBlankWindow(title string, x int, y int) *Node { return node } +/* func (n *Node) initBlankWindow() ui.Control { hbox := ui.NewHorizontalBox() hbox.SetPadded(true) return hbox } +*/ func makeBlankNode(title string) *Node { log.Println("gui.makeBlankNode() title =", title)