debian/andlabs/slider.go

30 lines
475 B
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"go.wit.com/gui/toolkits/tree"
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
2024-01-01 16:11:54 -06:00
)
func newSlider(p, n *tree.Node) {
if notNew(n) { return }
2024-01-01 16:11:54 -06:00
newt := new(guiWidget)
var x, y int
x = n.State.Range.Low
y = n.State.Range.High
s := ui.NewSlider(x, y)
2024-01-01 16:11:54 -06:00
newt.uiSlider = s
newt.uiControl = s
s.OnChanged(func(spin *ui.Slider) {
n.SetValue(newt.uiSlider.Value())
me.myTree.DoUserEvent(n)
2024-01-01 16:11:54 -06:00
})
n.TK = newt
place(p, n)
2024-01-01 16:11:54 -06:00
}