From 8100e7a1abdc31afbf65af6d0b7cd7cb0fff69eb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 27 Apr 2023 10:46:54 -0500 Subject: andlabs: more code cleanup Signed-off-by: Jeff Carr --- toolkit/andlabs/textbox.go | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'toolkit/andlabs/textbox.go') diff --git a/toolkit/andlabs/textbox.go b/toolkit/andlabs/textbox.go index 626eec4..5dca1bc 100644 --- a/toolkit/andlabs/textbox.go +++ b/toolkit/andlabs/textbox.go @@ -1,43 +1,21 @@ package main import ( - "git.wit.org/wit/gui/toolkit" - "github.com/andlabs/ui" _ "github.com/andlabs/ui/winmanifest" ) -// func newTextbox(a *toolkit.Action) { -func (t *andlabsT) newTextbox() *andlabsT { - var newt andlabsT - - c := ui.NewNonWrappingMultilineEntry() - newt.uiMultilineEntry = c - newt.uiControl = c +func (p *node) newTextbox(n *node) { + newt := new(andlabsT) - newt.WidgetType = toolkit.Textbox + e := ui.NewNonWrappingMultilineEntry() + newt.uiMultilineEntry = e + newt.uiControl = e - c.OnChanged(func(spin *ui.MultilineEntry) { - newt.s = spin.Text() - // this is still dangerous - log(debugChange, "Not yet safe to trigger on change for ui.MultilineEntry") + e.OnChanged(func(spin *ui.MultilineEntry) { newt.s = spin.Text() newt.doUserEvent() }) - return &newt -} - -func newTextbox(a *toolkit.Action) { - log(debugToolkit, "newCombobox()", a.Name) - - t := andlabs[a.ParentId] - if (t == nil) { - log(debugToolkit, "newCombobox() toolkit struct == nil. name=", a.Name) - listMap(debugToolkit) - return - } - newt := t.newTextbox() - newt.Name = a.Name - newt.wId = a.WidgetId - place(a, t, newt) + n.tk = newt + p.place(n) } -- cgit v1.2.3