andlabs/slider.go

32 lines
483 B
Go

package main
import (
"go.wit.com/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.State.CurrentI = newt.uiSlider.Value()
me.myTree.SendUserEvent(n)
})
n.TK = newt
place(p, n)
}