summaryrefslogtreecommitdiff
path: root/toolkit/andlabs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/andlabs')
-rw-r--r--toolkit/andlabs/button.go9
-rw-r--r--toolkit/andlabs/checkbox.go4
-rw-r--r--toolkit/andlabs/combobox.go6
-rw-r--r--toolkit/andlabs/common.go30
-rw-r--r--toolkit/andlabs/dropdown.go4
-rw-r--r--toolkit/andlabs/slider.go4
-rw-r--r--toolkit/andlabs/spinner.go4
-rw-r--r--toolkit/andlabs/textbox.go1
-rw-r--r--toolkit/andlabs/window.go1
9 files changed, 18 insertions, 45 deletions
diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go
index 94e2966..bc58da2 100644
--- a/toolkit/andlabs/button.go
+++ b/toolkit/andlabs/button.go
@@ -23,14 +23,15 @@ func newButton(a *toolkit.Action) {
b = ui.NewButton(a.Text)
newt.uiButton = b
newt.uiControl = b
- newt.tw = a.Widget
+ newt.wId = a.WidgetId
+ // newt.tw = a.Widget
newt.WidgetType = a.WidgetType
newt.parent = t
+ place(a, t, newt)
+
b.OnClicked(func(*ui.Button) {
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.doUserEvent()
})
- place(a, t, newt)
- // mapWidgetsToolkits(a, newt)
}
diff --git a/toolkit/andlabs/checkbox.go b/toolkit/andlabs/checkbox.go
index 69ba060..e4987e1 100644
--- a/toolkit/andlabs/checkbox.go
+++ b/toolkit/andlabs/checkbox.go
@@ -20,9 +20,9 @@ func (t *andlabsT) newCheckbox(a *toolkit.Action) *andlabsT {
newt.uiControl = newt.uiCheckbox
newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
- newt.tw.B = newt.checked()
+ newt.b = newt.checked()
log(debugChange, "val =", newt.tw.B)
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.doUserEvent()
})
return &newt
diff --git a/toolkit/andlabs/combobox.go b/toolkit/andlabs/combobox.go
index 100434e..293cc42 100644
--- a/toolkit/andlabs/combobox.go
+++ b/toolkit/andlabs/combobox.go
@@ -8,10 +8,8 @@ import (
func (t *andlabsT) newCombobox(a *toolkit.Action) *andlabsT {
var newt andlabsT
- w := a.Widget
log(debugToolkit, "newCombobox() START", a.Name)
- newt.tw = w
newt.wId = a.WidgetId
newt.WidgetType = a.WidgetType
s := ui.NewEditableCombobox()
@@ -23,8 +21,8 @@ func (t *andlabsT) newCombobox(a *toolkit.Action) *andlabsT {
newt.val = make(map[int]string)
s.OnChanged(func(spin *ui.EditableCombobox) {
- newt.tw.S = spin.Text()
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.s = spin.Text()
+ newt.doUserEvent()
})
return &newt
diff --git a/toolkit/andlabs/common.go b/toolkit/andlabs/common.go
index d905e5c..cd8e9c8 100644
--- a/toolkit/andlabs/common.go
+++ b/toolkit/andlabs/common.go
@@ -4,33 +4,9 @@ import (
"git.wit.org/wit/gui/toolkit"
)
-func (t *andlabsT) commonChange(tw *toolkit.Widget, wId int) {
- log(debugChange, "commonChange() START widget =", t.Name, t.WidgetType)
-// if (sendToChan(wId)) {
-// log(debugChange, "commonChange() END attempted channel worked", t.Name, t.WidgetType)
-// return
-// }
- if (tw == nil) {
- log(true, "commonChange() What the fuck. there is no widget t.tw == nil")
- return
- }
- if (tw.Custom == nil) {
- log(debugChange, "commonChange() END Widget.Custom() = nil", t.Name, t.WidgetType)
- return
- }
- tw.Custom()
-
- if (andlabs[wId] == nil) {
- log(debugError, "commonChange() ERROR: wId map == nil", wId)
- return
- }
-
- log(debugChange, "commonChange() END Widget.Custom()", t.Name, t.WidgetType)
-}
-
func (t *andlabsT) doUserEvent() {
if (callback == nil) {
- log(debugError, "douserEvent() callback == nil", t.wId)
+ log(debugError, "doUserEvent() callback == nil", t.wId)
return
}
var a toolkit.Action
@@ -40,8 +16,8 @@ func (t *andlabsT) doUserEvent() {
a.I = t.i
a.B = t.b
a.ActionType = toolkit.User
- log(logNow, "START: send a user event to the callback channel")
+ log(logInfo, "doUserEvent() START: send a user event to the callback channel")
callback <- a
- log(logNow, "END: sent a user event to the callback channel")
+ log(logInfo, "doUserEvent() END: sent a user event to the callback channel")
return
}
diff --git a/toolkit/andlabs/dropdown.go b/toolkit/andlabs/dropdown.go
index 036ed3e..d49ef1c 100644
--- a/toolkit/andlabs/dropdown.go
+++ b/toolkit/andlabs/dropdown.go
@@ -28,8 +28,8 @@ func (t *andlabsT) newDropdown(a *toolkit.Action) *andlabsT {
log(debugChange, "make map didn't work")
newt.text = "error"
}
- newt.tw.S = newt.val[i]
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.s = newt.val[i]
+ newt.doUserEvent()
})
return &newt
diff --git a/toolkit/andlabs/slider.go b/toolkit/andlabs/slider.go
index ed96f98..3f92067 100644
--- a/toolkit/andlabs/slider.go
+++ b/toolkit/andlabs/slider.go
@@ -19,8 +19,8 @@ func (t *andlabsT) newSlider(a *toolkit.Action) *andlabsT {
newt.wId = a.WidgetId
s.OnChanged(func(spin *ui.Slider) {
- newt.tw.I = newt.uiSlider.Value()
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.i = newt.uiSlider.Value()
+ newt.doUserEvent()
})
return &newt
diff --git a/toolkit/andlabs/spinner.go b/toolkit/andlabs/spinner.go
index 46be999..cfc1e67 100644
--- a/toolkit/andlabs/spinner.go
+++ b/toolkit/andlabs/spinner.go
@@ -20,8 +20,8 @@ func (t *andlabsT) newSpinner(a *toolkit.Action) *andlabsT {
newt.WidgetType = toolkit.Spinner
s.OnChanged(func(s *ui.Spinbox) {
- newt.tw.I = newt.uiSpinbox.Value()
- newt.commonChange(newt.tw, a.WidgetId)
+ newt.i = newt.uiSpinbox.Value()
+ newt.doUserEvent()
})
return &newt
diff --git a/toolkit/andlabs/textbox.go b/toolkit/andlabs/textbox.go
index 6ea01e1..36a9777 100644
--- a/toolkit/andlabs/textbox.go
+++ b/toolkit/andlabs/textbox.go
@@ -21,7 +21,6 @@ func (t *andlabsT) newTextbox(w *toolkit.Widget) *andlabsT {
c.OnChanged(func(spin *ui.MultilineEntry) {
t.s = spin.Text()
// this is still dangerous
- // newt.commonChange(newt.tw)
log(debugChange, "Not yet safe to trigger on change for ui.MultilineEntry")
})
return &newt
diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go
index 4b64b12..cfa419f 100644
--- a/toolkit/andlabs/window.go
+++ b/toolkit/andlabs/window.go
@@ -27,7 +27,6 @@ func newWindow(a *toolkit.Action) {
win.SetBorderless(canvas)
win.SetMargined(margin)
win.OnClosing(func(*ui.Window) bool {
- // newt.commonChange(newt.tw, a.WidgetId)
newt.doUserEvent()
return true
})