diff options
| author | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
| commit | 8dbf5a09097b7868e9218bf98716c57eac998a10 (patch) | |
| tree | ab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /toolkit/andlabs/dropdown.go | |
| parent | f3bb68396afa7452ecf1c8d4744c825a9d81057c (diff) | |
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing
merge forceDump(bool) into Dump()
debugging output configuration is pretty clean
keep cutting down duplicate things
--gui-verbose flag works
make label "standard" code
add debug.FreeOSMemory()
move the GO language internals to display in the GUI
update push to do tags and go to github.com/wit-go/
remove the other license file
it might be confusing golang.org and github
proper WidgetType
added a Quit() button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/dropdown.go')
| -rw-r--r-- | toolkit/andlabs/dropdown.go | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/toolkit/andlabs/dropdown.go b/toolkit/andlabs/dropdown.go index 2691a62..935741c 100644 --- a/toolkit/andlabs/dropdown.go +++ b/toolkit/andlabs/dropdown.go @@ -1,20 +1,20 @@ package main -import "github.com/andlabs/ui" -import _ "github.com/andlabs/ui/winmanifest" +import ( + "github.com/andlabs/ui" + _ "github.com/andlabs/ui/winmanifest" + "git.wit.org/wit/gui/toolkit" +) -import "git.wit.org/wit/gui/toolkit" - -func (t *andlabsT) NewDropdown(title string) *andlabsT { - // make new node here +func (t *andlabsT) NewDropdown(w *toolkit.Widget) *andlabsT { var newt andlabsT - - log(debugToolkit, "gui.Toolbox.NewDropdownCombobox()", title) + log(debugToolkit, "gui.Toolbox.NewDropdown() START", w.Name) if t.broken() { return nil } + newt.tw = w s := ui.NewCombobox() newt.uiCombobox = s newt.uiBox = t.uiBox @@ -27,11 +27,11 @@ func (t *andlabsT) NewDropdown(title string) *andlabsT { s.OnSelected(func(spin *ui.Combobox) { i := spin.Selected() if (newt.val == nil) { - log(debugToolkit, "make map didn't work") + log(debugChange, "make map didn't work") newt.text = "error" } - newt.text = newt.val[i] - newt.commonChange("Dropdown") + newt.tw.S = newt.val[i] + newt.commonChange(newt.tw) }) return &newt @@ -44,6 +44,12 @@ func (t *andlabsT) AddDropdownName(title string) { return } t.val[t.c] = title + + // If this is the first menu added, set the dropdown to it + if (t.c == 0) { + log(debugChange, "THIS IS THE FIRST Dropdown", title) + t.uiCombobox.SetSelected(1) + } t.c = t.c + 1 } @@ -57,11 +63,10 @@ func NewDropdown(parentW *toolkit.Widget, w *toolkit.Widget) { t := mapToolkits[parentW] if (t == nil) { log(debugToolkit, "go.andlabs.NewDropdown() toolkit struct == nil. name=", parentW.Name, w.Name) - listMap() + listMap(debugToolkit) + return } - newt := t.NewDropdown(w.Name) - newt.Custom = w.Custom - newt.tw = w + newt := t.NewDropdown(w) mapWidgetsToolkits(w, newt) } @@ -71,18 +76,21 @@ func AddDropdownName(w *toolkit.Widget, s string) { t := mapToolkits[w] if (t == nil) { log(debugToolkit, "go.andlabs.AddDropdownName() toolkit struct == nil. name=", w.Name, s) - listMap() + listMap(debugToolkit) + return } t.AddDropdownName(s) } -func SetDropdown(w *toolkit.Widget, i int) { - log(debugToolkit, "gui.andlabs.SetDropdown()", i) +func SetDropdownName(w *toolkit.Widget, s string) { + log(debugChange, "gui.andlabs.SetDropdown()", w.Name, ",", s) t := mapToolkits[w] if (t == nil) { - log(debugToolkit, "go.andlabs.SetDropdown() toolkit struct == nil. name=", w.Name, i) - listMap() + log(debugError, "ERROR: SetDropdown() FAILED mapToolkits[w] == nil. name=", w.Name, s) + listMap(debugError) + return } - t.SetDropdown(i) + t.SetDropdown(1) + t.tw.S = s } |
