fix against gui v0.12.13

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-17 22:43:57 -06:00
parent 9e8a40023c
commit 2411bcd276
3 changed files with 29 additions and 28 deletions

View File

@ -125,7 +125,7 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
og = w.Box().NewGroup("output").Pad()
outputTextbox = og.NewTextbox("outputBox")
outputTextbox.Custom = func () {
log.Log(INFO, "custom TextBox() for golang output a =", outputTextbox.GetText())
log.Log(INFO, "custom TextBox() for golang output a =", outputTextbox.String())
}
return w

12
main.go
View File

@ -132,9 +132,9 @@ func dropdownWindow(p *gui.Node) {
var mapWindows map[string]*gui.Node
mapWindows = make(map[string]*gui.Node)
dd := p.NewDropdown("Window Dropdown")
dd := p.NewDropdown()
dd.Custom = func() {
name := dd.GetText()
name := dd.String()
activeWidget = mapWindows[name]
setActiveWidget(activeWidget)
log.Log(INFO, "The Window was set to", name)
@ -149,7 +149,7 @@ func dropdownWindow(p *gui.Node) {
// var last = ""
for _, child := range p.Children() {
log.Log(INFO, "\t\t", child.GetProgName())
dd.AddDropdownName(child.GetProgName())
dd.AddText(child.GetProgName())
// last = child.Name
mapWindows[child.GetProgName()] = child
if (activeWidget == nil) {
@ -163,9 +163,9 @@ func dropdownWindowWidgets(p *gui.Node) {
var mapWindows map[string]*gui.Node
mapWindows = make(map[string]*gui.Node)
dd := p.NewDropdown("Window Widgets Dropdown")
dd := p.NewDropdown()
dd.Custom = func() {
name := dd.GetText()
name := dd.String()
activeWidget = mapWindows[name]
setActiveWidget(activeWidget)
}
@ -177,7 +177,7 @@ func dropdownWindowWidgets(p *gui.Node) {
addDropdowns = func (n *gui.Node) {
// s := n.dumpWidget(true)
s := n.GetProgName()
dd.AddDropdownName(s)
dd.AddText(s)
mapWindows[s] = n
for _, child := range n.Children() {

View File

@ -6,6 +6,7 @@ import (
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/widget"
"go.wit.com/gui/gadgets"
)
@ -42,7 +43,7 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
g2 = g.NewGroup("type:")
activeLabelType = g2.NewLabel("undef")
g2 = g.NewGroup("New name:")
activeLabelNewName = g2.NewCombobox("newthing")
activeLabelNewName = g2.NewCombobox()
activeLabelNewName.AddText("penguin")
activeLabelNewName.AddText("snow")
activeLabelNewName.AddText("GO")
@ -84,7 +85,7 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
g = w.Box().NewGroup("change things")
g.NewButton("AddText()", func () {
activeWidget.AddText(activeLabelNewName.GetText())
activeWidget.AddText(activeLabelNewName.String())
/*
activeWidget.S = activeLabelNewName.S
a := newAction(activeWidget, toolkit.AddText)
@ -92,9 +93,9 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
*/
})
g.NewButton("SetText()", func () {
activeWidget.SetText(activeLabelNewName.GetText())
activeWidget.SetText(activeLabelNewName.String())
/*
activeWidget.S = activeLabelNewName.GetText()
activeWidget.S = activeLabelNewName.String()
a := newAction(activeWidget, toolkit.SetText)
sendAction(a)
*/
@ -135,20 +136,20 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
func debugAddWidgetButtons(n *gui.Node) {
n.NewButton("Dropdown", func () {
a := activeWidget.NewDropdown("tmp dropdown")
a := activeWidget.NewDropdown()
a.AddText("this is better than tcl/tk")
a.AddText("make something for tim for qflow")
a.AddText("and for riscv")
a.Custom = func () {
log.Log(WARN, "custom dropdown() a =", a.GetProgName(), a.GetText())
log.Log(WARN, "custom dropdown() a =", a.GetProgName(), a.String())
}
})
n.NewButton("Combobox", func () {
a := activeWidget.NewCombobox("tmp combobox")
a := activeWidget.NewCombobox()
a.AddText("mirrors.wit.com")
a.AddText("go.wit.com")
a.Custom = func () {
log.Log(WARN, "custom combobox() a =", a.GetProgName(), a.GetText())
log.Log(WARN, "custom combobox() a =", a.GetProgName(), a.String())
}
})
n.NewButton("Grid", func () {
@ -188,7 +189,7 @@ func debugAddWidgetButtons(n *gui.Node) {
}
func debugAddWidgetButton(n *gui.Node) {
activeLabelNewType = n.NewDropdown("tmp dropdown")
activeLabelNewType = n.NewDropdown()
activeLabelNewType.AddText("Window")
activeLabelNewType.AddText("Tab")
activeLabelNewType.AddText("Frame")
@ -211,10 +212,10 @@ func debugAddWidgetButton(n *gui.Node) {
activeLabelNewType.AddText("Dialog")
n.NewButton("Add", func () {
name := activeLabelNewName.GetText()
newX := activeLabelNewX.GetInt()
newY := activeLabelNewY.GetInt()
newB := activeLabelNewB.GetBool()
name := activeLabelNewName.String()
newX := widget.GetInt(activeLabelNewX.String())
newY := widget.GetInt(activeLabelNewY.String())
newB := widget.GetBool(activeLabelNewB.String())
if (newY == -1) {
name = name + " (" + strconv.Itoa(activeWidget.NextW) + "," + strconv.Itoa(activeWidget.NextH) + ")"
@ -223,7 +224,7 @@ func debugAddWidgetButton(n *gui.Node) {
name = name + " (" + strconv.Itoa(newX) + "," + strconv.Itoa(newY) + ")"
}
log.Log(INFO, "New Name =", name)
log.Log(INFO, "New Type =", activeLabelNewType.GetText())
log.Log(INFO, "New Type =", activeLabelNewType.String())
log.Log(INFO, "New X =", newX)
log.Log(INFO, "New Y =", newY)
log.Log(INFO, "activeWidget.NextW =", activeWidget.NextW)
@ -234,7 +235,7 @@ func debugAddWidgetButton(n *gui.Node) {
// activeWidget.X = newX
// activeWidget.Y = newY
switch activeLabelNewType.GetText() {
switch activeLabelNewType.String() {
case "Grid":
activeWidget.NewGrid(name, newX, newY)
case "Group":
@ -246,19 +247,19 @@ func debugAddWidgetButton(n *gui.Node) {
log.Log(WARN, "got to button", name)
})
case "Checkbox":
a := activeWidget.NewCheckbox(name)
a := activeWidget.NewCheckbox("DBG")
a.Custom = func () {
log.Log(WARN, "custom checkox func a=", a.GetBool())
log.Log(WARN, "custom checkox func a=", a.String())
}
case "Dropdown":
a := activeWidget.NewDropdown(name)
a := activeWidget.NewDropdown()
a.AddText(name + " yay")
a.AddText(name + " haha")
a.Custom = func () {
log.Log(WARN, "WTF a=", a.GetBool())
log.Log(WARN, "WTF a=", a.String())
}
case "Combobox":
a := activeWidget.NewCombobox(name)
a := activeWidget.NewCombobox()
a.AddText(name + " foo")
a.AddText(name + " bar")
case "Label":
@ -270,7 +271,7 @@ func debugAddWidgetButton(n *gui.Node) {
case "Spinner":
activeWidget.NewSpinner(name, newX, newY)
default:
log.Error(errors.New("make what type?"), activeLabelNewType.GetText())
log.Error(errors.New("make what type?"), activeLabelNewType.String())
}
})
}