summaryrefslogtreecommitdiff
path: root/int.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
committerJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
commitf3af1f5b7ff78b3f73d7510622fc9633dec36d35 (patch)
treee4868584d5e19942938aaa122b2e1cab377db000 /int.go
parentf7b1036e544238d65b0e3ad46d08075aa4177032 (diff)
Refactor to 'gui/toolkit/'
* add a example cmds/consolemouse uses a console button to launch the andlabs/ui * fix wrong return value in toolkit/NewLabel() * redirect STDIN output to a file * wonderful fix of Window() exit * finally remove the ancient stupid variables x & y * phase out struct 'box' and use 'node' instead * better names for things: use NewFoo() and NewBar()
Diffstat (limited to 'int.go')
-rw-r--r--int.go30
1 files changed, 24 insertions, 6 deletions
diff --git a/int.go b/int.go
index 9543344..4a32c52 100644
--- a/int.go
+++ b/int.go
@@ -4,13 +4,15 @@ import "log"
import "github.com/davecgh/go-spew/spew"
-// import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
+/*
+ Get the int from the gui toolkit
+ because eventually this gui package should become it's own seperate go routine and never interact from the
+ gui subroutine back into the upstream application using the gui package
-
-// Get the int from the gui toolkit
-// TODO: instead store the int in the Node structure? (this is probably a better idea)
-// because eventually this gui package should become it's own seperate go routine and never interact from the
-// gui subroutine back into the upstream application using the gui package
+ TODO: instead store the int in the Node structure? (this is probably a better idea)
+ because technically every interaction with the toolkit has to go through the Queue() goroutine.
+ Is it "has to go" or "should go"? Probably it makes sense to strictly inforce it. No "callback" functions. IPC only (go channels)
+*/
func (n *Node) Int() int {
if (Config.DebugToolkit) {
log.Println("gui.Node.Int() for node name =", n.Name)
@@ -26,3 +28,19 @@ func (n *Node) Int() int {
i := n.Toolkit.Value()
return i
}
+
+// which name to use?
+func (n *Node) Value() int {
+ return n.Int()
+}
+
+func (n *Node) SetValue(i int) {
+ log.Println("gui.SetValue() START")
+ if (n.Toolkit == nil) {
+ log.Println("gui.Node.SetValue() for toolkit struct = nil")
+ panic("SetValue failed")
+ }
+ n.Dump()
+ n.Toolkit.Dump()
+ n.Toolkit.SetValue(i)
+}