diff options
| author | Jeff Carr <[email protected]> | 2022-10-16 08:07:13 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-10-16 08:07:13 -0500 |
| commit | 2141e04328dcf4e4d6857fcc0a7cb551fc84fa07 (patch) | |
| tree | f8b2a5d8cf17f9ccfcfa8c1699fe4a52ea8338e2 /slider.go | |
| parent | 3c899365154e48aefbc0b5ee48cd089f49339cb2 (diff) | |
Add slander and spinbox in toolkit/andlabs
fix the helloworld demo
move slider into toolkit/
move more into the toolkit directory
add spinbox()
fix example
minor update
fix examples
Fix andlabs.ui.Slider() to work again
correctly implement custom OnChange() callback
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'slider.go')
| -rw-r--r-- | slider.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/slider.go b/slider.go new file mode 100644 index 0000000..6129bd6 --- /dev/null +++ b/slider.go @@ -0,0 +1,24 @@ +package gui + +import "log" + +import toolkit "git.wit.org/wit/gui/toolkit/andlabs" + +func (n *Node) NewSlider(name string, x int, y int) *Node { + // make new node here + log.Println("toolkit.NewSlider", x, y) + + newNode := n.makeNode(name, 767, 676 + Config.counter) + newNode.Name = name + + t := toolkit.NewSlider(n.uiBox, name, x, y) + t.OnChanged = func(t *toolkit.Toolkit) { + log.Println("toolkit.NewSlider() value =", t.Value()) + if (newNode.OnChanged != nil) { + newNode.OnChanged(newNode) + } + } + newNode.Toolkit = t + + return newNode +} |
