summaryrefslogtreecommitdiff
path: root/action.go
diff options
context:
space:
mode:
Diffstat (limited to 'action.go')
-rw-r--r--action.go52
1 files changed, 42 insertions, 10 deletions
diff --git a/action.go b/action.go
index 6db01eb..1580bf7 100644
--- a/action.go
+++ b/action.go
@@ -16,6 +16,27 @@ import (
"go.wit.com/widget"
)
+func (n *Node) SetVisable(b bool) {
+ n.visable = b
+}
+
+// returns true if the window is not visable to the user
+// in which case events are not sent to the toolkit
+func (n *Node) WindowVisable() bool {
+ if n == nil {
+ return true
+ }
+ if n.WidgetType == widget.Window {
+ return n.visable
+ }
+ if n.parent == nil {
+ return true
+ } else {
+ return n.parent.WindowVisable()
+ }
+ return true
+}
+
// 2024/01/11 finally moving to type any. simplify to just 'value'
// 2023/05/09 pretty clean
// 2023/04/06 Queue() is also being used and channels are being used.
@@ -27,16 +48,27 @@ func sendAction(n *Node, atype widget.ActionType) {
}
n.mu.Lock()
defer n.mu.Unlock()
- log.Warn("SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
+ // log.Warn("SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
// if the widget is hidden, don't send actions to the plugin
- if n.hidden {
- if atype == widget.Hide {
- // well, unless this is a Hide action, then inform the toolkit
- log.Warn("SENDING HIDDEN ACTION. IS THIS A WINDOW?", n.GetProgName(), atype)
- } else {
- log.Warn("NOT SENDING HIDDEN ACTION", n.GetProgName(), atype)
- // return
+ /*
+ if n.hidden {
+ if atype == widget.Hide {
+ // well, unless this is a Hide action, then inform the toolkit
+ log.Warn("SENDING HIDDEN ACTION. IS THIS A WINDOW?", n.GetProgName(), atype)
+ } else {
+ log.Warn("NOT SENDING HIDDEN ACTION", n.GetProgName(), atype)
+ // return
+ }
+ }
+ */
+
+ // this checks to see if the window is show in the toolkit. If it is not,
+ // then don't send any events. Unless it is a window widget, then send events
+ if n.WidgetType != widget.Window {
+ if !n.WindowVisable() {
+ log.Warn("NOT SENDING ACTION. Window is not visable", n.id, n.WidgetType, n.GetProgName())
+ return
}
}
@@ -61,8 +93,8 @@ func sendAction(n *Node, atype widget.ActionType) {
for s, _ := range n.strings {
a.State.Strings = append(a.State.Strings, s)
}
- log.Warn("SENDING ACTION STRINGS a.Strings", a.Strings)
- log.Warn("SENDING ACTION a.State.Value", a.State.Value)
+ // log.Warn("SENDING ACTION STRINGS a.Strings", a.Strings)
+ // log.Warn("SENDING ACTION a.State.Value", a.State.Value)
a.State.Range.Low = n.X
a.State.Range.High = n.Y