diff options
| author | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
| commit | 947169df5a22c9f9b53f825764747f648c70ff1e (patch) | |
| tree | 3c84fffc14352329bc41e6b58910ff278c99f08c /toolkit/andlabs | |
| parent | 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 (diff) | |
ready for version v0.7.4
start deprecating toolkit.Widget
switch to variable name 'ParentId'
use 'ActionType' and 'WidgetType'
preliminary redraw()
final definition of variables 'Name' and 'Text'
more cleaning of the code
remove lots of dumb code
bind 'd' key press to dump out debugging info
early color handling in gocui!
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs')
| -rw-r--r-- | toolkit/andlabs/action.go | 92 | ||||
| -rw-r--r-- | toolkit/andlabs/add.go | 40 | ||||
| -rw-r--r-- | toolkit/andlabs/box.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/button.go | 10 | ||||
| -rw-r--r-- | toolkit/andlabs/checkbox.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/combobox.go | 6 | ||||
| -rw-r--r-- | toolkit/andlabs/debug.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/dropdown.go | 6 | ||||
| -rw-r--r-- | toolkit/andlabs/grid.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/group.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/image.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/label.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/plugin.go | 47 | ||||
| -rw-r--r-- | toolkit/andlabs/slider.go | 10 | ||||
| -rw-r--r-- | toolkit/andlabs/spinner.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/tab.go | 24 | ||||
| -rw-r--r-- | toolkit/andlabs/textbox.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/window.go | 4 |
18 files changed, 137 insertions, 136 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go index 68fc34a..9d098df 100644 --- a/toolkit/andlabs/action.go +++ b/toolkit/andlabs/action.go @@ -59,7 +59,7 @@ func pad(a *toolkit.Action) { switch t.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiGroup.SetMargined(true) case toolkit.Unmargin: @@ -70,7 +70,7 @@ func pad(a *toolkit.Action) { t.uiGroup.SetMargined(false) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: tabSetMargined(t.uiTab, true) case toolkit.Unmargin: @@ -81,7 +81,7 @@ func pad(a *toolkit.Action) { tabSetMargined(t.uiTab, false) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiWindow.SetMargined(true) case toolkit.Unmargin: @@ -92,7 +92,7 @@ func pad(a *toolkit.Action) { t.uiWindow.SetBorderless(true) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiGrid.SetPadded(true) case toolkit.Unmargin: @@ -103,7 +103,7 @@ func pad(a *toolkit.Action) { t.uiGrid.SetPadded(false) } case toolkit.Box: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiBox.SetPadded(true) case toolkit.Unmargin: @@ -114,17 +114,17 @@ func pad(a *toolkit.Action) { t.uiBox.SetPadded(false) } case toolkit.Textbox: - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) default: - log(debugError, "TODO: implement pad() for", a.Type) + log(debugError, "TODO: implement pad() for", a.ActionType) } } func move(a *toolkit.Action) { - log(debugNow, "move()", a.WidgetId, "to", a.WhereId) + log(debugNow, "move()", a.WidgetId, "to", a.ParentId) tWidget := andlabs[a.WidgetId] if (tWidget == nil) { @@ -132,55 +132,55 @@ func move(a *toolkit.Action) { return } - tWhere := andlabs[a.WhereId] - if (tWhere == nil) { - log(debugError, "move() ERROR: toolkit struct == nil. for", a.WhereId) + tParent := andlabs[a.ParentId] + if (tParent == nil) { + log(debugError, "move() ERROR: toolkit struct == nil. for", a.ParentId) return } - switch tWhere.Type { + switch tParent.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - tWhere.uiGroup.SetMargined(true) + tParent.uiGroup.SetMargined(true) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - // tabSetMargined(tWhere.uiTab, true) + // tabSetMargined(tParent.uiTab, true) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiWindow.SetBorderless(false) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiGrid.SetPadded(true) } case toolkit.Box: - log(debugNow, "TODO: move() for a =", a.Type) - log(debugNow, "TODO: move() where =", a.WhereId) + log(debugNow, "TODO: move() for a =", a.ActionType) + log(debugNow, "TODO: move() where =", a.ParentId) log(debugNow, "TODO: move() for widget =", a.WidgetId) stretchy = true - tWhere.uiBox.Append(tWidget.uiControl, stretchy) - // log(debugNow, "is there a tWhere parent? =", tWhere.parent) - // tWhere.uiBox.Delete(0) + tParent.uiBox.Append(tWidget.uiControl, stretchy) + // log(debugNow, "is there a tParent parent? =", tParent.parent) + // tParent.uiBox.Delete(0) // this didn't work: // tWidget.uiControl.Disable() // sleep(.8) default: - log(debugError, "TODO: need to implement move() for a =", a.Type) - log(debugError, "TODO: need to implement move() for where =", a.WhereId) + log(debugError, "TODO: need to implement move() for a =", a.ActionType) + log(debugError, "TODO: need to implement move() for where =", a.ParentId) log(debugError, "TODO: need to implement move() for widget =", a.WidgetId) } } func uiDelete(a *toolkit.Action) { - if (andlabs[a.WhereId] == nil) { + if (andlabs[a.ParentId] == nil) { log(debugError, "uiDelete() ERROR: can not uiDelete to nil") return } @@ -188,7 +188,7 @@ func uiDelete(a *toolkit.Action) { log(debugError, "uiDelete() ERROR: can not uiDelete nil") return } - log(debugNow, "uiDelete()", a.WidgetId, "to", a.WhereId) + log(debugNow, "uiDelete()", a.WidgetId, "to", a.ParentId) tWidget := andlabs[a.WidgetId] if (tWidget == nil) { @@ -196,38 +196,38 @@ func uiDelete(a *toolkit.Action) { return } - tWhere := andlabs[a.WhereId] - if (tWhere == nil) { - log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.WhereId) + tParent := andlabs[a.ParentId] + if (tParent == nil) { + log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.ParentId) return } - switch tWhere.Type { + switch tParent.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - tWhere.uiGroup.SetMargined(true) + tParent.uiGroup.SetMargined(true) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - // tabSetMargined(tWhere.uiTab, true) + // tabSetMargined(tParent.uiTab, true) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiWindow.SetBorderless(false) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiGrid.SetPadded(true) } case toolkit.Box: - log(debugNow, "tWidget.boxC =", tWhere.Name) - log(debugNow, "is there a tWhere parent? =", tWhere.parent) + log(debugNow, "tWidget.boxC =", tParent.Name) + log(debugNow, "is there a tParent parent? =", tParent.parent) if (tWidget.boxC < 1) { - log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", tWhere.boxC) + log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", tParent.boxC) return } tWidget.uiBox.Delete(0) @@ -236,10 +236,10 @@ func uiDelete(a *toolkit.Action) { // this didn't work: // tWidget.uiControl.Disable() // sleep(.8) - // tWhere.uiBox.Append(tWidget.uiControl, stretchy) + // tParent.uiBox.Append(tWidget.uiControl, stretchy) default: - log(debugError, "TODO: need to implement uiDelete() for a =", a.Type) - log(debugError, "TODO: need to implement uiDelete() for where =", a.WhereId) + log(debugError, "TODO: need to implement uiDelete() for a =", a.ActionType) + log(debugError, "TODO: need to implement uiDelete() for where =", a.ParentId) log(debugError, "TODO: need to implement uiDelete() for widget =", a.WidgetId) } } diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go index 6bc8f2d..b03ee9c 100644 --- a/toolkit/andlabs/add.go +++ b/toolkit/andlabs/add.go @@ -8,11 +8,11 @@ import ( ) func actionDump(b bool, a *toolkit.Action) { - log(b, "actionDump() Widget.Type =", a.Type) + log(b, "actionDump() Widget.Type =", a.ActionType) log(b, "actionDump() Widget.S =", a.S) log(b, "actionDump() Widget.I =", a.I) log(b, "actionDump() WidgetId =", a.WidgetId) - log(b, "actionDump() WhereId =", a.WhereId) + log(b, "actionDump() ParentId =", a.ParentId) } func add(a *toolkit.Action) { @@ -28,21 +28,21 @@ func add(a *toolkit.Action) { } // for now, window gets handled without checking where == nil) - if (a.WidgetT == toolkit.Window) { + if (a.WidgetType == toolkit.Window) { doWindow(a) return } - if (andlabs[a.WhereId] == nil) { + if (andlabs[a.ParentId] == nil) { // listMap(debugError) // memory corruption? - log(debugError, "add() Widget.Name =", a.Title) - log(debugError, "add() Widget.Type =", a.WidgetT) - log(debugError, "ERROR add() ERROR a.Where map to t == nil. WidgetId =", a.WidgetId, "WhereId =", a.WhereId) + log(debugError, "add() Widget.Name =", a.Name) + log(debugError, "add() Widget.Type =", a.WidgetType) + log(debugError, "ERROR add() ERROR a.Parent map to t == nil. WidgetId =", a.WidgetId, "ParentId =", a.ParentId) exit("can not add()") return } - switch a.WidgetT { + switch a.WidgetType { case toolkit.Window: doWindow(a) return @@ -86,7 +86,7 @@ func add(a *toolkit.Action) { newImage(a) return default: - log(debugError, "add() error TODO: ", a.WidgetT, a.Title) + log(debugError, "add() error TODO: ", a.WidgetType, a.Name) } } @@ -115,32 +115,32 @@ func add(a *toolkit.Action) { // -- (0,1) -- (1,1) -- (1,1) -- // ----------------------------- func place(a *toolkit.Action, t *andlabsT, newt *andlabsT) bool { - log(debugAction, "place() START", a.WidgetT, a.Title) + log(debugAction, "place() START", a.WidgetType, a.Name) // add the structure to the array if (andlabs[a.WidgetId] == nil) { - log(logInfo, "newTab() MAPPED", a.WidgetId, a.WhereId) + log(logInfo, "newTab() MAPPED", a.WidgetId, a.ParentId) andlabs[a.WidgetId] = newt - newt.Type = a.WidgetT + newt.Type = a.WidgetType } else { - log(debugError, "newTab() DO WHAT?", a.WidgetId, a.WhereId) + log(debugError, "newTab() DO WHAT?", a.WidgetId, a.ParentId) log(debugError, "THIS IS BAD") } if (newt.uiControl == nil) { - log(debugError, "place() ERROR uiControl == nil", a.WhereId) + log(debugError, "place() ERROR uiControl == nil", a.ParentId) return false } - where := andlabs[a.WhereId] + where := andlabs[a.ParentId] if (where == nil) { - log(debugError, "place() ERROR where == nil", a.WhereId) + log(debugError, "place() ERROR where == nil", a.ParentId) return false } switch where.Type { case toolkit.Grid: - log(debugGrid, "add() Grid try at Where X,Y =", a.X, a.Y) + log(debugGrid, "add() Grid try at Parent X,Y =", a.X, a.Y) newt.gridX = a.X newt.gridY = a.Y log(debugGrid, "add() Grid try at gridX,gridY", newt.gridX, newt.gridY) @@ -152,14 +152,14 @@ func place(a *toolkit.Action, t *andlabsT, newt *andlabsT) bool { case toolkit.Group: if (t.uiBox == nil) { t.uiGroup.SetChild(newt.uiControl) - log(debugGrid, "add() hack Group to use this as the box?", a.Title, a.WidgetT) + log(debugGrid, "add() hack Group to use this as the box?", a.Name, a.WidgetType) t.uiBox = newt.uiBox } else { t.uiBox.Append(newt.uiControl, stretchy) } return true case toolkit.Tab: - t.uiTab.Append(a.Title, newt.uiControl) + t.uiTab.Append(a.Text, newt.uiControl) t.boxC += 1 return true case toolkit.Box: @@ -170,7 +170,7 @@ func place(a *toolkit.Action, t *andlabsT, newt *andlabsT) bool { t.uiWindow.SetChild(newt.uiControl) return true default: - log(debugError, "add() how?", a.WhereId) + log(debugError, "add() how?", a.ParentId) } return false } diff --git a/toolkit/andlabs/box.go b/toolkit/andlabs/box.go index 651b54d..527041d 100644 --- a/toolkit/andlabs/box.go +++ b/toolkit/andlabs/box.go @@ -9,14 +9,14 @@ import ( // make new Box here func newBox(a *toolkit.Action) { - log(debugToolkit, "newBox()", a.Title) + log(debugToolkit, "newBox()", a.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newBox() toolkit struct == nil. name=", a.Title) + log(debugToolkit, "newBox() toolkit struct == nil. name=", a.Name) listMap(debugToolkit) } - newt := t.rawBox(a.Title, a.B) + newt := t.rawBox(a.Text, a.B) newt.boxC = 0 place(a, t, newt) andlabs[a.WidgetId] = newt diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go index 59ec51c..1f9fdaf 100644 --- a/toolkit/andlabs/button.go +++ b/toolkit/andlabs/button.go @@ -10,21 +10,21 @@ import ( func newButton(a *toolkit.Action) { var t, newt *andlabsT var b *ui.Button - log(debugToolkit, "newButton()", a.Title) + log(debugToolkit, "newButton()", a.Name) - t = andlabs[a.WhereId] + t = andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Title) + log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Name) return } newt = new(andlabsT) - b = ui.NewButton(a.Title) + b = ui.NewButton(a.Text) newt.uiButton = b newt.uiControl = b newt.tw = a.Widget - newt.Type = a.WidgetT + newt.Type = a.WidgetType newt.parent = t b.OnClicked(func(*ui.Button) { diff --git a/toolkit/andlabs/checkbox.go b/toolkit/andlabs/checkbox.go index a9c6a3a..f73a284 100644 --- a/toolkit/andlabs/checkbox.go +++ b/toolkit/andlabs/checkbox.go @@ -31,9 +31,9 @@ func (t *andlabsT) checked() bool { } func newCheckbox(a *toolkit.Action) { - log(debugToolkit, "newCheckbox()", a.Title) + log(debugToolkit, "newCheckbox()", a.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { listMap(debugError) return diff --git a/toolkit/andlabs/combobox.go b/toolkit/andlabs/combobox.go index 59d312d..e7d51a7 100644 --- a/toolkit/andlabs/combobox.go +++ b/toolkit/andlabs/combobox.go @@ -45,11 +45,11 @@ func (t *andlabsT) AddComboboxName(title string) { } func newCombobox(a *toolkit.Action) { - log(debugToolkit, "newCombobox()", a.Title) + log(debugToolkit, "newCombobox()", a.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newCombobox() toolkit struct == nil. name=", a.Title) + log(debugToolkit, "newCombobox() toolkit struct == nil. name=", a.Name) listMap(debugToolkit) return } diff --git a/toolkit/andlabs/debug.go b/toolkit/andlabs/debug.go index 7d69485..a581657 100644 --- a/toolkit/andlabs/debug.go +++ b/toolkit/andlabs/debug.go @@ -90,6 +90,7 @@ func widgetDump(b bool, w *toolkit.Widget) { return } + /* log(b, "widget.Name =", w.Name) log(b, "widget.Type =", w.Type) log(b, "widget.Custom =", w.Custom) @@ -99,6 +100,7 @@ func widgetDump(b bool, w *toolkit.Widget) { log(b, "widget.Height =", w.Height) log(b, "widget.X =", w.X) log(b, "widget.Y =", w.Y) + */ } /* diff --git a/toolkit/andlabs/dropdown.go b/toolkit/andlabs/dropdown.go index bf17cac..d020ed8 100644 --- a/toolkit/andlabs/dropdown.go +++ b/toolkit/andlabs/dropdown.go @@ -9,7 +9,7 @@ import ( func (t *andlabsT) newDropdown(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - log(debugToolkit, "gui.Toolbox.newDropdown() START", a.Title) + log(debugToolkit, "gui.Toolbox.newDropdown() START", a.Name) newt.tw = w newt.Type = w.Type @@ -82,9 +82,9 @@ func SetDropdownName(a *toolkit.Action, s string) { } func newDropdown(a *toolkit.Action) { - log(debugToolkit, "gui.andlabs.newDropdown()", a.Title) + log(debugToolkit, "gui.andlabs.newDropdown()", a.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugToolkit, "go.andlabs.newDropdown() toolkit struct == nil. name=", a.WidgetId) listMap(debugToolkit) diff --git a/toolkit/andlabs/grid.go b/toolkit/andlabs/grid.go index da4cf2a..be05b70 100644 --- a/toolkit/andlabs/grid.go +++ b/toolkit/andlabs/grid.go @@ -14,7 +14,7 @@ import ( // ----------------------------- func newGrid(a *toolkit.Action) { var newt *andlabsT - log(debugToolkit, "newGrid()", a.WidgetId, "to", a.WhereId) + log(debugToolkit, "newGrid()", a.WidgetId, "to", a.ParentId) newt = new(andlabsT) @@ -26,6 +26,6 @@ func newGrid(a *toolkit.Action) { newt.gridX = 0 newt.gridY = 0 - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] place(a, t, newt) } diff --git a/toolkit/andlabs/group.go b/toolkit/andlabs/group.go index d581823..0769151 100644 --- a/toolkit/andlabs/group.go +++ b/toolkit/andlabs/group.go @@ -11,7 +11,7 @@ func newGroup(a *toolkit.Action) { w := a.Widget log(debugToolkit, "NewGroup()", w.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugToolkit, "NewGroup() toolkit struct == nil. name=", w.Name) listMap(debugToolkit) diff --git a/toolkit/andlabs/image.go b/toolkit/andlabs/image.go index cbb29cb..a3d1cb6 100644 --- a/toolkit/andlabs/image.go +++ b/toolkit/andlabs/image.go @@ -12,7 +12,7 @@ func newImage(a *toolkit.Action) { w := a.Widget log(debugToolkit, "newImage()", w.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugToolkit, "newImage() toolkit struct == nil. name=", w.Name) listMap(debugToolkit) diff --git a/toolkit/andlabs/label.go b/toolkit/andlabs/label.go index fb66aa0..c6bd670 100644 --- a/toolkit/andlabs/label.go +++ b/toolkit/andlabs/label.go @@ -12,7 +12,7 @@ func newLabel(a *toolkit.Action) { w := a.Widget log(debugToolkit, "NewLabel()", w.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { listMap(debugError) log(debugError, "ERROR newLabel() listMap()") diff --git a/toolkit/andlabs/plugin.go b/toolkit/andlabs/plugin.go index fdfbd24..6c2dd76 100644 --- a/toolkit/andlabs/plugin.go +++ b/toolkit/andlabs/plugin.go @@ -44,13 +44,18 @@ func Action(a *toolkit.Action) { func rawAction(a *toolkit.Action) { - log(debugAction, "Action() START a.Type =", a.Type) + log(debugAction, "Action() START a.ActionType =", a.ActionType) log(debugAction, "Action() START a.S =", a.S) log(debugAction, "Action() START a.Widget =", a.Widget) - log(logInfo, "Action() START a.WidgetId =", a.WidgetId, "a.WhereId =", a.WhereId) + log(logInfo, "Action() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) + switch a.WidgetType { + case toolkit.Flag: + flag(a) + return + } - switch a.Type { + switch a.ActionType { case toolkit.Add: add(a) case toolkit.Show: @@ -75,8 +80,6 @@ func rawAction(a *toolkit.Action) { } case toolkit.Set: setText(a) - case toolkit.SetFlag: - flag(a) case toolkit.SetText: setText(a) case toolkit.AddText: @@ -91,15 +94,13 @@ func rawAction(a *toolkit.Action) { pad(a) case toolkit.Delete: uiDelete(a) - case toolkit.Flag: - flag(a) case toolkit.Move: - log(debugNow, "attempt to move() =", a.Type, a.Widget) + log(debugNow, "attempt to move() =", a.ActionType, a.Widget) move(a) default: - log(debugError, "Action() Unknown =", a.Type, a.Widget) + log(debugError, "Action() Unknown =", a.ActionType, a.Widget) } - log(debugAction, "Action() END =", a.Type, a.Widget) + log(debugAction, "Action() END =", a.ActionType, a.Widget) } func flag(a *toolkit.Action) { @@ -146,7 +147,7 @@ func setText(a *toolkit.Action) { case toolkit.Group: t.uiGroup.SetTitle(a.S) case toolkit.Checkbox: - switch a.Type { + switch a.ActionType { case toolkit.SetText: t.uiCheckbox.SetText(a.S) case toolkit.Get: @@ -156,10 +157,10 @@ func setText(a *toolkit.Action) { // t.uiCheckbox.SetChecked(a.B) t.tw.B = a.B default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } case toolkit.Textbox: - switch a.Type { + switch a.ActionType { case toolkit.Set: t.uiMultilineEntry.SetText(a.S) case toolkit.SetText: @@ -169,32 +170,32 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } case toolkit.Label: t.uiLabel.SetText(a.S) case toolkit.Button: t.uiButton.SetText(a.S) case toolkit.Slider: - switch a.Type { + switch a.ActionType { case toolkit.Get: t.tw.I = t.uiSlider.Value() case toolkit.Set: t.uiSlider.SetValue(a.I) default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } case toolkit.Spinner: - switch a.Type { + switch a.ActionType { case toolkit.Get: t.tw.I = t.uiSpinbox.Value() case toolkit.Set: t.uiSpinbox.SetValue(a.I) default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } case toolkit.Dropdown: - switch a.Type { + switch a.ActionType { case toolkit.AddText: AddDropdownName(a) case toolkit.Set: @@ -226,10 +227,10 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } case toolkit.Combobox: - switch a.Type { + switch a.ActionType { case toolkit.AddText: t.AddComboboxName(a.S) case toolkit.Set: @@ -243,9 +244,9 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.Type, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) } default: - log(debugError, "plugin Send() Don't know how to setText on", t.tw.Type, "yet", a.Type) + log(debugError, "plugin Send() Don't know how to setText on", t.tw.Type, "yet", a.ActionType) } } diff --git a/toolkit/andlabs/slider.go b/toolkit/andlabs/slider.go index 8554bab..5a16bff 100644 --- a/toolkit/andlabs/slider.go +++ b/toolkit/andlabs/slider.go @@ -10,9 +10,9 @@ import ( func (t *andlabsT) newSlider(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - log(debugToolkit, w.Name, w.Type, w.X, w.Y) + // log(debugToolkit, w.Name, w.Type, w.X, w.Y) - s := ui.NewSlider(w.X, w.Y) + s := ui.NewSlider(a.X, a.Y) newt.uiSlider = s newt.uiControl = s newt.tw = w @@ -32,13 +32,13 @@ func newSlider(a *toolkit.Action) { w := a.Widget log(debugToolkit, "newSlider()", w.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugError, "newSlider() ERROR toolkit struct == nil. name=", w.Name) return } - w.X = a.X - w.Y = a.Y + // w.X = a.X + // w.Y = a.Y newt = t.newSlider(a) place(a, t, newt) } diff --git a/toolkit/andlabs/spinner.go b/toolkit/andlabs/spinner.go index 3f1f657..58e0934 100644 --- a/toolkit/andlabs/spinner.go +++ b/toolkit/andlabs/spinner.go @@ -10,9 +10,9 @@ import ( func (t *andlabsT) newSpinner(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - log(debugToolkit, "newSpinner()", w.X, w.Y) + // log(debugToolkit, "newSpinner()", w.X, w.Y) - s := ui.NewSpinbox(w.X, w.Y) + s := ui.NewSpinbox(a.X, a.Y) newt.uiSpinbox = s newt.uiControl = s newt.tw = w @@ -31,13 +31,11 @@ func newSpinner(a *toolkit.Action) { var newt *andlabsT w := a.Widget - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugError, "NewSpinner() toolkit struct == nil. name=", w.Name) return } - w.X = a.X - w.Y = a.Y newt = t.newSpinner(a) place(a, t, newt) } diff --git a/toolkit/andlabs/tab.go b/toolkit/andlabs/tab.go index c28b403..0753338 100644 --- a/toolkit/andlabs/tab.go +++ b/toolkit/andlabs/tab.go @@ -23,34 +23,34 @@ func (t *andlabsT) newTab(a *toolkit.Action) { // var w *ui.Window var newt *andlabsT - log(debugToolkit, "newTab() START", a.WidgetId, a.WhereId) + log(debugToolkit, "newTab() START", a.WidgetId, a.ParentId) if (t.uiTab == nil) { if (t.uiWindow == nil) { - log(debugToolkit, "newTab() uiWindow == nil. I can't add a toolbar without window", a.WidgetId, a.WhereId) + log(debugToolkit, "newTab() uiWindow == nil. I can't add a toolbar without window", a.WidgetId, a.ParentId) return } // this means you have to make a new tab - log(debugToolkit, "newTab() GOOD. This should be the first tab:", a.WidgetId, a.WhereId) - newt = rawTab(t.uiWindow, a.Title) + log(debugToolkit, "newTab() GOOD. This should be the first tab:", a.WidgetId, a.ParentId) + newt = rawTab(t.uiWindow, a.Text) t.uiTab = newt.uiTab } else { // this means you have to append a tab - log(debugToolkit, "newTab() GOOD. This should be an additional tab:", a.WidgetId, a.WhereId) - newt = t.appendTab(a.Title) + log(debugToolkit, "newTab() GOOD. This should be an additional tab:", a.WidgetId, a.ParentId) + newt = t.appendTab(a.Text) } // add the structure to the array if (andlabs[a.WidgetId] == nil) { - log(logInfo, "newTab() MAPPED", a.WidgetId, a.WhereId) + log(logInfo, "newTab() MAPPED", a.WidgetId, a.ParentId) andlabs[a.WidgetId] = newt newt.Type = a.Widget.Type } else { - log(debugError, "newTab() DO WHAT?", a.WidgetId, a.WhereId) + log(debugError, "newTab() DO WHAT?", a.WidgetId, a.ParentId) log(debugError, "THIS IS BAD") } - newt.Name = a.Title + newt.Name = a.Name log(debugToolkit, "t:") t.Dump(debugToolkit) @@ -120,11 +120,11 @@ func (t *andlabsT) appendTab(name string) *andlabsT { func newTab(a *toolkit.Action) { // w := a.Widget - log(debugToolkit, "newTab()", a.WhereId) + log(debugToolkit, "newTab()", a.ParentId) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newTab() parent toolkit == nil. new tab can not be made =", a.WhereId) + log(debugToolkit, "newTab() parent toolkit == nil. new tab can not be made =", a.ParentId) log(debugToolkit, "look for a window? check for an existing tab?") return } diff --git a/toolkit/andlabs/textbox.go b/toolkit/andlabs/textbox.go index cd86517..ef39d33 100644 --- a/toolkit/andlabs/textbox.go +++ b/toolkit/andlabs/textbox.go @@ -32,7 +32,7 @@ func newTextbox(a *toolkit.Action) { w := a.Widget log(debugToolkit, "newCombobox()", w.Name) - t := andlabs[a.WhereId] + t := andlabs[a.ParentId] if (t == nil) { log(debugToolkit, "newCombobox() toolkit struct == nil. name=", w.Name) listMap(debugToolkit) diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go index 297f2af..2fee729 100644 --- a/toolkit/andlabs/window.go +++ b/toolkit/andlabs/window.go @@ -19,7 +19,7 @@ func newWindow(a *toolkit.Action) { w := a.Widget var newt *andlabsT - log(debugToolkit, "toolkit NewWindow", w.Name, w.Width, w.Height) + // log(debugToolkit, "toolkit NewWindow", w.Name, w.Width, w.Height) if (w == nil) { log(debugToolkit, "wit/gui plugin error. widget == nil") @@ -31,7 +31,7 @@ func newWindow(a *toolkit.Action) { newt.wId = a.WidgetId // menubar bool is if the OS defined border on the window should be used - win := ui.NewWindow(w.Name, w.Width, w.Height, menubar) + win := ui.NewWindow(w.Name, a.Width, a.Height, menubar) win.SetBorderless(canvas) win.SetMargined(margin) win.OnClosing(func(*ui.Window) bool { |
