fix against gui v0.12.13
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
9e8a40023c
commit
2411bcd276
|
@ -125,7 +125,7 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
|
||||||
og = w.Box().NewGroup("output").Pad()
|
og = w.Box().NewGroup("output").Pad()
|
||||||
outputTextbox = og.NewTextbox("outputBox")
|
outputTextbox = og.NewTextbox("outputBox")
|
||||||
outputTextbox.Custom = func () {
|
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
|
return w
|
||||||
|
|
12
main.go
12
main.go
|
@ -132,9 +132,9 @@ func dropdownWindow(p *gui.Node) {
|
||||||
var mapWindows map[string]*gui.Node
|
var mapWindows map[string]*gui.Node
|
||||||
mapWindows = make(map[string]*gui.Node)
|
mapWindows = make(map[string]*gui.Node)
|
||||||
|
|
||||||
dd := p.NewDropdown("Window Dropdown")
|
dd := p.NewDropdown()
|
||||||
dd.Custom = func() {
|
dd.Custom = func() {
|
||||||
name := dd.GetText()
|
name := dd.String()
|
||||||
activeWidget = mapWindows[name]
|
activeWidget = mapWindows[name]
|
||||||
setActiveWidget(activeWidget)
|
setActiveWidget(activeWidget)
|
||||||
log.Log(INFO, "The Window was set to", name)
|
log.Log(INFO, "The Window was set to", name)
|
||||||
|
@ -149,7 +149,7 @@ func dropdownWindow(p *gui.Node) {
|
||||||
// var last = ""
|
// var last = ""
|
||||||
for _, child := range p.Children() {
|
for _, child := range p.Children() {
|
||||||
log.Log(INFO, "\t\t", child.GetProgName())
|
log.Log(INFO, "\t\t", child.GetProgName())
|
||||||
dd.AddDropdownName(child.GetProgName())
|
dd.AddText(child.GetProgName())
|
||||||
// last = child.Name
|
// last = child.Name
|
||||||
mapWindows[child.GetProgName()] = child
|
mapWindows[child.GetProgName()] = child
|
||||||
if (activeWidget == nil) {
|
if (activeWidget == nil) {
|
||||||
|
@ -163,9 +163,9 @@ func dropdownWindowWidgets(p *gui.Node) {
|
||||||
var mapWindows map[string]*gui.Node
|
var mapWindows map[string]*gui.Node
|
||||||
mapWindows = make(map[string]*gui.Node)
|
mapWindows = make(map[string]*gui.Node)
|
||||||
|
|
||||||
dd := p.NewDropdown("Window Widgets Dropdown")
|
dd := p.NewDropdown()
|
||||||
dd.Custom = func() {
|
dd.Custom = func() {
|
||||||
name := dd.GetText()
|
name := dd.String()
|
||||||
activeWidget = mapWindows[name]
|
activeWidget = mapWindows[name]
|
||||||
setActiveWidget(activeWidget)
|
setActiveWidget(activeWidget)
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ func dropdownWindowWidgets(p *gui.Node) {
|
||||||
addDropdowns = func (n *gui.Node) {
|
addDropdowns = func (n *gui.Node) {
|
||||||
// s := n.dumpWidget(true)
|
// s := n.dumpWidget(true)
|
||||||
s := n.GetProgName()
|
s := n.GetProgName()
|
||||||
dd.AddDropdownName(s)
|
dd.AddText(s)
|
||||||
mapWindows[s] = n
|
mapWindows[s] = n
|
||||||
|
|
||||||
for _, child := range n.Children() {
|
for _, child := range n.Children() {
|
||||||
|
|
43
widget.go
43
widget.go
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
|
"go.wit.com/gui/widget"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
|
||||||
g2 = g.NewGroup("type:")
|
g2 = g.NewGroup("type:")
|
||||||
activeLabelType = g2.NewLabel("undef")
|
activeLabelType = g2.NewLabel("undef")
|
||||||
g2 = g.NewGroup("New name:")
|
g2 = g.NewGroup("New name:")
|
||||||
activeLabelNewName = g2.NewCombobox("newthing")
|
activeLabelNewName = g2.NewCombobox()
|
||||||
activeLabelNewName.AddText("penguin")
|
activeLabelNewName.AddText("penguin")
|
||||||
activeLabelNewName.AddText("snow")
|
activeLabelNewName.AddText("snow")
|
||||||
activeLabelNewName.AddText("GO")
|
activeLabelNewName.AddText("GO")
|
||||||
|
@ -84,7 +85,7 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
|
||||||
|
|
||||||
g = w.Box().NewGroup("change things")
|
g = w.Box().NewGroup("change things")
|
||||||
g.NewButton("AddText()", func () {
|
g.NewButton("AddText()", func () {
|
||||||
activeWidget.AddText(activeLabelNewName.GetText())
|
activeWidget.AddText(activeLabelNewName.String())
|
||||||
/*
|
/*
|
||||||
activeWidget.S = activeLabelNewName.S
|
activeWidget.S = activeLabelNewName.S
|
||||||
a := newAction(activeWidget, toolkit.AddText)
|
a := newAction(activeWidget, toolkit.AddText)
|
||||||
|
@ -92,9 +93,9 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
|
||||||
*/
|
*/
|
||||||
})
|
})
|
||||||
g.NewButton("SetText()", func () {
|
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)
|
a := newAction(activeWidget, toolkit.SetText)
|
||||||
sendAction(a)
|
sendAction(a)
|
||||||
*/
|
*/
|
||||||
|
@ -135,20 +136,20 @@ func DebugWidgetWindow(p *gui.Node) *gadgets.BasicWindow {
|
||||||
|
|
||||||
func debugAddWidgetButtons(n *gui.Node) {
|
func debugAddWidgetButtons(n *gui.Node) {
|
||||||
n.NewButton("Dropdown", func () {
|
n.NewButton("Dropdown", func () {
|
||||||
a := activeWidget.NewDropdown("tmp dropdown")
|
a := activeWidget.NewDropdown()
|
||||||
a.AddText("this is better than tcl/tk")
|
a.AddText("this is better than tcl/tk")
|
||||||
a.AddText("make something for tim for qflow")
|
a.AddText("make something for tim for qflow")
|
||||||
a.AddText("and for riscv")
|
a.AddText("and for riscv")
|
||||||
a.Custom = func () {
|
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 () {
|
n.NewButton("Combobox", func () {
|
||||||
a := activeWidget.NewCombobox("tmp combobox")
|
a := activeWidget.NewCombobox()
|
||||||
a.AddText("mirrors.wit.com")
|
a.AddText("mirrors.wit.com")
|
||||||
a.AddText("go.wit.com")
|
a.AddText("go.wit.com")
|
||||||
a.Custom = func () {
|
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 () {
|
n.NewButton("Grid", func () {
|
||||||
|
@ -188,7 +189,7 @@ func debugAddWidgetButtons(n *gui.Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func debugAddWidgetButton(n *gui.Node) {
|
func debugAddWidgetButton(n *gui.Node) {
|
||||||
activeLabelNewType = n.NewDropdown("tmp dropdown")
|
activeLabelNewType = n.NewDropdown()
|
||||||
activeLabelNewType.AddText("Window")
|
activeLabelNewType.AddText("Window")
|
||||||
activeLabelNewType.AddText("Tab")
|
activeLabelNewType.AddText("Tab")
|
||||||
activeLabelNewType.AddText("Frame")
|
activeLabelNewType.AddText("Frame")
|
||||||
|
@ -211,10 +212,10 @@ func debugAddWidgetButton(n *gui.Node) {
|
||||||
activeLabelNewType.AddText("Dialog")
|
activeLabelNewType.AddText("Dialog")
|
||||||
|
|
||||||
n.NewButton("Add", func () {
|
n.NewButton("Add", func () {
|
||||||
name := activeLabelNewName.GetText()
|
name := activeLabelNewName.String()
|
||||||
newX := activeLabelNewX.GetInt()
|
newX := widget.GetInt(activeLabelNewX.String())
|
||||||
newY := activeLabelNewY.GetInt()
|
newY := widget.GetInt(activeLabelNewY.String())
|
||||||
newB := activeLabelNewB.GetBool()
|
newB := widget.GetBool(activeLabelNewB.String())
|
||||||
|
|
||||||
if (newY == -1) {
|
if (newY == -1) {
|
||||||
name = name + " (" + strconv.Itoa(activeWidget.NextW) + "," + strconv.Itoa(activeWidget.NextH) + ")"
|
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) + ")"
|
name = name + " (" + strconv.Itoa(newX) + "," + strconv.Itoa(newY) + ")"
|
||||||
}
|
}
|
||||||
log.Log(INFO, "New Name =", name)
|
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 X =", newX)
|
||||||
log.Log(INFO, "New Y =", newY)
|
log.Log(INFO, "New Y =", newY)
|
||||||
log.Log(INFO, "activeWidget.NextW =", activeWidget.NextW)
|
log.Log(INFO, "activeWidget.NextW =", activeWidget.NextW)
|
||||||
|
@ -234,7 +235,7 @@ func debugAddWidgetButton(n *gui.Node) {
|
||||||
// activeWidget.X = newX
|
// activeWidget.X = newX
|
||||||
// activeWidget.Y = newY
|
// activeWidget.Y = newY
|
||||||
|
|
||||||
switch activeLabelNewType.GetText() {
|
switch activeLabelNewType.String() {
|
||||||
case "Grid":
|
case "Grid":
|
||||||
activeWidget.NewGrid(name, newX, newY)
|
activeWidget.NewGrid(name, newX, newY)
|
||||||
case "Group":
|
case "Group":
|
||||||
|
@ -246,19 +247,19 @@ func debugAddWidgetButton(n *gui.Node) {
|
||||||
log.Log(WARN, "got to button", name)
|
log.Log(WARN, "got to button", name)
|
||||||
})
|
})
|
||||||
case "Checkbox":
|
case "Checkbox":
|
||||||
a := activeWidget.NewCheckbox(name)
|
a := activeWidget.NewCheckbox("DBG")
|
||||||
a.Custom = func () {
|
a.Custom = func () {
|
||||||
log.Log(WARN, "custom checkox func a=", a.GetBool())
|
log.Log(WARN, "custom checkox func a=", a.String())
|
||||||
}
|
}
|
||||||
case "Dropdown":
|
case "Dropdown":
|
||||||
a := activeWidget.NewDropdown(name)
|
a := activeWidget.NewDropdown()
|
||||||
a.AddText(name + " yay")
|
a.AddText(name + " yay")
|
||||||
a.AddText(name + " haha")
|
a.AddText(name + " haha")
|
||||||
a.Custom = func () {
|
a.Custom = func () {
|
||||||
log.Log(WARN, "WTF a=", a.GetBool())
|
log.Log(WARN, "WTF a=", a.String())
|
||||||
}
|
}
|
||||||
case "Combobox":
|
case "Combobox":
|
||||||
a := activeWidget.NewCombobox(name)
|
a := activeWidget.NewCombobox()
|
||||||
a.AddText(name + " foo")
|
a.AddText(name + " foo")
|
||||||
a.AddText(name + " bar")
|
a.AddText(name + " bar")
|
||||||
case "Label":
|
case "Label":
|
||||||
|
@ -270,7 +271,7 @@ func debugAddWidgetButton(n *gui.Node) {
|
||||||
case "Spinner":
|
case "Spinner":
|
||||||
activeWidget.NewSpinner(name, newX, newY)
|
activeWidget.NewSpinner(name, newX, newY)
|
||||||
default:
|
default:
|
||||||
log.Error(errors.New("make what type?"), activeLabelNewType.GetText())
|
log.Error(errors.New("make what type?"), activeLabelNewType.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue