package main

import (
	"go.wit.com/dev/andlabs/ui"
	_ "go.wit.com/dev/andlabs/ui/winmanifest"
)

func (p *node) newTextbox(n *node) {
	newt := new(guiWidget)

	if (n.X == 1) {
		e := ui.NewEntry()
		newt.uiEntry = e
		newt.uiControl = e

		e.OnChanged(func(spin *ui.Entry) {
			n.value = spin.Text()
			n.doUserEvent()
		})
	} else {
		e := ui.NewNonWrappingMultilineEntry()
		newt.uiMultilineEntry = e
		newt.uiControl = e

		e.OnChanged(func(spin *ui.MultilineEntry) {
			n.value = spin.Text()
			n.doUserEvent()
		})
	}
	n.tk = newt
	p.place(n)
}
