summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/textbox.go
blob: 626eec43f7f6a803e895161e64e5b15ffed90878 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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

	newt.WidgetType = toolkit.Textbox

	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")
		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)
}