diff options
| -rw-r--r-- | action.go | 7 | ||||
| -rw-r--r-- | addText.go | 2 | ||||
| -rw-r--r-- | common.go | 13 | ||||
| -rw-r--r-- | debug.go | 4 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | node.go | 9 | ||||
| -rw-r--r-- | setText.go | 14 | ||||
| -rw-r--r-- | structs.go | 5 | ||||
| -rw-r--r-- | textbox.go | 4 | ||||
| -rw-r--r-- | watchdog.go | 1 | ||||
| -rw-r--r-- | window.go | 1 |
11 files changed, 33 insertions, 29 deletions
@@ -60,7 +60,10 @@ func getNewAction(n *Node, atype widget.ActionType) *widget.Action { // set state a.State.ProgName = n.progname a.State.Label = n.label - a.State.Value = n.value + // a.State.Value = n.value + a.State.DefaultS = n.defaultS + a.State.CurrentS = n.currentS + a.State.NewString = n.newString a.State.Checked = n.checked a.State.Visable = n.visable @@ -79,7 +82,7 @@ func getNewAction(n *Node, atype widget.ActionType) *widget.Action { a.State.Range.High = n.Y a.ProgName = n.progname - a.Value = n.value + // a.Value = n.value a.Direction = n.direction // These should be improved/deprecated based on the gui/widget docs @@ -17,7 +17,7 @@ func (n *Node) addText(newS string) { } } n.strings[newS] = highest + 1 // TODO: use the int's for the order - n.value = newS + n.newString = newS /* // time.Sleep(time.Duration(1000 * time.Nanosecond)) // doesn't work // maybe this stupid chipset is defective. TODO: try on different hardware @@ -99,7 +99,7 @@ func (n *Node) Bool() bool { default: } - return widget.GetBool(n.value) + return false } func (n *Node) Int() int { @@ -107,14 +107,13 @@ func (n *Node) Int() int { return -1 } - return widget.GetInt(n.value) + return -1 } func (n *Node) SetBool(b bool) { switch n.WidgetType { case widget.Checkbox: n.checked = b - n.value = b default: log.Warn("WidgetType not bool", n.WidgetType, n.id) } @@ -123,7 +122,7 @@ func (n *Node) SetBool(b bool) { func (n *Node) SetInt(i int) { switch n.WidgetType { default: - n.value = i + // n.value = i // log.Warn("WidgetType not bool", n.WidgetType, n.id) } } @@ -144,7 +143,7 @@ func (n *Node) String() string { default: } - return widget.GetString(n.value) + return widget.GetString(n.currentS) } func (n *Node) Strings() []string { @@ -181,8 +180,8 @@ func (n *Node) AppendText(str string) { if !n.Ready() { return } - tmp := widget.GetString(n.value) + str - n.value = tmp + tmp := n.currentS + str + n.newString = tmp n.changed = true // inform the toolkits @@ -64,10 +64,10 @@ func (n *Node) dumpWidget(b bool) string { if b { switch n.WidgetType { case widget.Combobox: - logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.value) + logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.currentS) logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.strings) case widget.Dropdown: - logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.value) + logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.currentS) logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.strings) case widget.Grid: logindent(b, listChildrenDepth, defaultPadding, " GridSize =", n.X, n.Y) @@ -143,7 +143,7 @@ func (n *Node) gotUserEvent(a widget.Action) { default: } - n.value = a.Value + n.currentS = a.State.CurrentS log.Log(CHANGE, "gotUserEvent() n.Bool() =", n.Bool(), "n.String() =", n.String()) if n.Custom == nil { log.Log(CHANGE, "a Custom() function was not set for this widget") @@ -13,7 +13,7 @@ and it initializes basic default values there isn't much to see here. */ -func (n *Node) newNode(title string, t widget.WidgetType) *Node { +func (n *Node) newNode(s string, t widget.WidgetType) *Node { if n == nil { log.Warn("newNode got parent == nil") panic("gui newNode") @@ -21,8 +21,11 @@ func (n *Node) newNode(title string, t widget.WidgetType) *Node { var newN *Node newN = addNode() - newN.progname = title - newN.value = title + newN.progname = s + newN.label = s + newN.defaultS = s + newN.newString = s + newN.currentS = s newN.WidgetType = t newN.strings = make(map[string]int) @@ -16,10 +16,6 @@ func (n *Node) SetLabel(label string) *Node { n.label = label case widget.Button: n.label = label - case widget.Combobox: - n.label = label - case widget.Dropdown: - n.label = label case widget.Label: n.label = label case widget.Group: @@ -30,7 +26,7 @@ func (n *Node) SetLabel(label string) *Node { } n.changed = true - log.Log(CHANGE, "SetLabel() value =", label) + log.Log(CHANGE, "SetLabel() =", label) // inform the toolkits sendAction(n, widget.SetText) @@ -40,7 +36,7 @@ func (n *Node) SetLabel(label string) *Node { // What "SetText" means depends on the type of widget // should this be a different name? func (n *Node) SetText(text string) *Node { - n.value = text + n.newString = text n.changed = true log.Log(CHANGE, "SetText() text =", text) @@ -54,15 +50,15 @@ func (n *Node) SetText(text string) *Node { case widget.Group: n.label = text case widget.Combobox: - n.label = text + n.newString = text case widget.Dropdown: - n.label = text + n.newString = text case widget.Window: n.label = text default: } // inform the toolkits - sendAction(n, widget.Set) + sendAction(n, widget.SetText) return n } @@ -96,7 +96,10 @@ type Node struct { WidgetType widget.WidgetType // most widgets need one value, this is current alue - value any + // value any + defaultS string + newString string + currentS string // label string @@ -8,7 +8,7 @@ import ( func (parent *Node) NewTextbox(name string) *Node { newNode := parent.newNode(name, widget.Textbox) - newNode.value = name + newNode.defaultS = name newNode.progname = name newNode.Custom = func() { @@ -22,7 +22,7 @@ func (parent *Node) NewTextbox(name string) *Node { func (parent *Node) NewEntryLine(name string) *Node { newNode := parent.newNode(name, widget.Textbox) - newNode.value = name + newNode.defaultS = name newNode.progname = name newNode.X = 1 diff --git a/watchdog.go b/watchdog.go index 121e91b..e27a31e 100644 --- a/watchdog.go +++ b/watchdog.go @@ -19,6 +19,7 @@ func Watchdog() { myTicker(10*time.Second, "WATCHDOG", func() { i += 1 log.Log(INFO, "myTicker() ticked", i) + me.rootNode.ListToolkits() }) } @@ -29,7 +29,6 @@ func (parent *Node) NewWindow(title string) *Node { log.Log(INFO, "NewWindow()", title) newNode.progname = title newNode.label = title - newNode.value = title newNode.margin = true newNode.visable = true newNode.hidden = false |
