summaryrefslogtreecommitdiff
path: root/andlabs/slider.go
blob: 5ce393a69101d78f409a05117b50c3bb43048f58 (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
package main

import (
	"go.wit.com/gui/toolkits/tree"

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

func newSlider(p, n *tree.Node) {
	if notNew(n) { return }
	newt := new(guiWidget)

	var x, y int
	x = n.State.Range.Low
	y = n.State.Range.High

	s := ui.NewSlider(x, y)
	newt.uiSlider = s
	newt.uiControl = s

	s.OnChanged(func(spin *ui.Slider) {
		n.SetValue(newt.uiSlider.Value())
		me.myTree.DoUserEvent(n)
	})

	n.TK = newt
	place(p, n)
}