NODE: make NewGroup()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-25 09:52:21 -05:00
parent a926aa300e
commit 25de1c5cdb
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,8 @@ package gui
import ( import (
"log" "log"
// "fmt"
"strconv"
"github.com/andlabs/ui" "github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
@ -243,7 +245,7 @@ func makeWindowDebug() *ui.Box {
log.Println("nodeNames[y] =", nodeNames[y]) log.Println("nodeNames[y] =", nodeNames[y])
node := Data.findId(nodeNames[y]) node := Data.findId(nodeNames[y])
if (node != nil) { if (node != nil) {
node.AddDemoTab("added this DemoTab") node.AddDemoTab("ran gui.AddDemoTab() " + strconv.Itoa(Config.counter))
} }
}) })

View File

@ -14,7 +14,9 @@ func (n *Node) AddDemoTab(title string) {
tabSetMargined(newNode.uiTab) tabSetMargined(newNode.uiTab)
newNode.Dump() newNode.Dump()
newNode.ListChildren(false) newNode.ListChildren(false)
addDemoGroup(newNode.uiBox) addDemoGroup(newNode, "new group 1")
addDemoGroup(newNode, "new group 2")
addDemoGroup(newNode, "new group 3")
} }
func makeDemoTab() *ui.Box { func makeDemoTab() *ui.Box {
@ -45,11 +47,12 @@ func makeDemoTab() *ui.Box {
return hbox return hbox
} }
func addDemoGroup(hbox *ui.Box) { func addDemoGroup(n *Node, title string) {
hbox := n.uiBox
if (hbox == nil) { if (hbox == nil) {
return return
} }
group := ui.NewGroup("DemoEditBox 2") group := ui.NewGroup(title)
group.SetMargined(true) group.SetMargined(true)
hbox.Append(group, true) hbox.Append(group, true)