summaryrefslogtreecommitdiff
path: root/cloudflare/oneLiner.go
blob: 5fc7a51e2abe0926f9ca0fdd0c099efb88da2315 (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
// This is a simple example
package cloudflare

import 	(
	"log"

	"go.wit.com/gui"
)

type OneLiner struct {
	p	*gui.Node	// parent widget
	l	*gui.Node	// label widget
	v	*gui.Node	// value widget

	value	string
	label	string

	Custom func()
}

func (n *OneLiner) Set(value string) {
	log.Println("OneLiner.Set() =", value)
	n.v.Set(value)
	n.value = value
}

func NewOneLiner(n *gui.Node, name string) *OneLiner {
	d := OneLiner {
		p: n,
		value: "",
	}

	// various timeout settings
	d.l = n.NewLabel(name)
	d.v = n.NewLabel("")
	d.v.Custom = func() {
		d.value = d.v.S
		log.Println("OneLiner.Custom() user changed value to =", d.value)
	}

	return &d
}