NODE: finally remove initBlankWindow()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-25 07:51:17 -05:00
parent c74e39a9ef
commit 23e471d9c1
3 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)