From b25f15ea7803e172204432082740d081e5f19f81 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 17 Jan 2024 23:54:19 -0600 Subject: the golang way. everything in it's own repo Signed-off-by: Jeff Carr --- textbox.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 textbox.go (limited to 'textbox.go') diff --git a/textbox.go b/textbox.go new file mode 100644 index 0000000..1e90dd3 --- /dev/null +++ b/textbox.go @@ -0,0 +1,37 @@ +package main + +import ( + "go.wit.com/toolkits/tree" + + "go.wit.com/dev/andlabs/ui" + _ "go.wit.com/dev/andlabs/ui/winmanifest" +) + +func newTextbox(p, n *tree.Node) { + if notNew(n) { + return + } + newt := new(guiWidget) + + if n.State.Range.Low == 1 { + e := ui.NewEntry() + newt.uiEntry = e + newt.uiControl = e + + e.OnChanged(func(spin *ui.Entry) { + n.SetValue(spin.Text()) + me.myTree.DoUserEvent(n) + }) + } else { + e := ui.NewNonWrappingMultilineEntry() + newt.uiMultilineEntry = e + newt.uiControl = e + + e.OnChanged(func(spin *ui.MultilineEntry) { + n.SetValue(spin.Text()) + me.myTree.DoUserEvent(n) + }) + } + n.TK = newt + place(p, n) +} -- cgit v1.2.3