summaryrefslogtreecommitdiff
path: root/action.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-21 14:44:47 -0600
committerJeff Carr <[email protected]>2024-01-21 14:44:47 -0600
commit1fdf786a72fd4af0c1acca45b250b5f66ef3e31b (patch)
tree0f247e40f69c8bdce56574a3b608c78955b6b447 /action.go
parentba70be3064c1d082eb0e9146562b7f07dd894fb0 (diff)
visable state is honored. TODO: fix hide/show
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'action.go')
-rw-r--r--action.go38
1 files changed, 32 insertions, 6 deletions
diff --git a/action.go b/action.go
index a1566a8..533b32e 100644
--- a/action.go
+++ b/action.go
@@ -22,19 +22,30 @@ func (n *Node) SetVisable(b bool) {
// returns true if the window is not visable to the user
// in which case events are not sent to the toolkit
+// TODO: fix this so ParentVisable() works
func (n *Node) WindowVisable() bool {
if n == nil {
- return true
+ return false
}
if n.WidgetType == widget.Window {
return n.visable
}
if n.parent == nil {
- return true
- } else {
- return n.parent.WindowVisable()
+ return false
}
- return true
+ return n.parent.WindowVisable()
+}
+
+// returns true if the parent is not visable to the user
+// in which case events are not sent to the toolkit
+func (n *Node) ParentVisable() bool {
+ if n == nil {
+ return false
+ }
+ if n.parent == nil {
+ return false
+ }
+ return n.parent.visable
}
// 2024/01/11 finally moving to type any. simplify to just 'value'
@@ -52,10 +63,25 @@ func sendAction(n *Node, atype widget.ActionType) {
// 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() {
+ if n.WindowVisable() {
+ // lots of output. make this verbose?
+ log.Log(INFO, "Sending action to widget. Window is visable", n.id, n.WidgetType, n.GetProgName())
+ } else {
+ // lots of output. make this verbose?
log.Log(INFO, "Not sending action to widget. Window is not visable", n.id, n.WidgetType, n.GetProgName())
return
}
+ // set if the widget is visable based on the parent
+ // this has nothing to do with show() and hide()
+ if n.ParentVisable() {
+ log.Log(NOW, "Parent is visable n =", n.id, n.WidgetType, n.GetProgName())
+ n.visable = true
+ } else {
+ log.Log(NOW, "Parent is not visable n =", n.id, n.WidgetType, n.GetProgName())
+ log.Log(NOW, "not sending action to toolkits")
+ n.visable = false
+ return
+ }
}
var a widget.Action