diff options
Diffstat (limited to 'andlabs/setText.go')
| -rw-r--r-- | andlabs/setText.go | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/andlabs/setText.go b/andlabs/setText.go index 1dcb2f2..b89787d 100644 --- a/andlabs/setText.go +++ b/andlabs/setText.go @@ -75,39 +75,28 @@ func (n *node) setText(a *widget.Action) { log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name) } case widget.Dropdown: - switch a.ActionType { - case widget.AddText: - n.AddDropdownName(a.S) - case widget.Set: - var orig int - var i int = -1 - var s string - orig = t.uiCombobox.Selected() - log.Log(CHANGE, "try to set the Dropdown to", a.S, "from", orig) - // try to find the string - for i, s = range t.val { - log.Log(CHANGE, "i, s", i, s) - if (a.S == s) { - t.uiCombobox.SetSelected(i) - log.Log(CHANGE, "setText() Dropdown worked.", n.S) - return - } - } - log.Log(ERROR, "setText() Dropdown did not find:", a.S) - // if i == -1, then there are not any things in the menu to select - if (i == -1) { - return - } - // if the string was never set, then set the dropdown to the last thing added to the menu - if (orig == -1) { + var orig int + var i int = -1 + var s string + orig = t.uiCombobox.Selected() + log.Log(CHANGE, "try to set the Dropdown to", a.S, "from", orig) + // try to find the string + for i, s = range t.val { + log.Log(CHANGE, "i, s", i, s) + if (a.S == s) { t.uiCombobox.SetSelected(i) + log.Log(CHANGE, "setText() Dropdown worked.", n.S) + return } - case widget.Get: - // t.S = t.s - case widget.GetText: - // t.S = t.s - default: - log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name) + } + log.Log(ERROR, "setText() Dropdown did not find:", a.S) + // if i == -1, then there are not any things in the menu to select + if (i == -1) { + return + } + // if the string was never set, then set the dropdown to the last thing added to the menu + if (orig == -1) { + t.uiCombobox.SetSelected(i) } case widget.Combobox: switch a.ActionType { |
