andlabs/slider.go

32 lines
476 B
Go
Raw Permalink Normal View History

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.SetValue(newt.uiSlider.Value())
me.myTree.SendUserEvent(n)
})
n.TK = newt
place(p, n)
}