summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-28 12:09:48 -0600
committerJeff Carr <[email protected]>2024-01-28 12:09:48 -0600
commit44ee09f79843d3b9fca666b2c2dbd298a4c4eaba (patch)
treebc64f54827858e35729f3e5ca3c34f2167faa286
parenteca2f2aa481ea9c158592767eeeaceff09060466 (diff)
buttons work
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--click.go3
-rw-r--r--debug.go2
-rw-r--r--widget.go6
3 files changed, 8 insertions, 3 deletions
diff --git a/click.go b/click.go
index 1f3f144..169f007 100644
--- a/click.go
+++ b/click.go
@@ -309,6 +309,9 @@ func findUnderMouse() *tree.Node {
var widget *guiWidget
widget = n.TK.(*guiWidget)
// ignore widgets that are not visible
+ if widget.node.WidgetId == 2222 {
+ widget.SetVisible(false)
+ }
if widget.Visible() {
if (widget.gocuiSize.w0 <= w) && (w <= widget.gocuiSize.w1) &&
(widget.gocuiSize.h0 <= h) && (h <= widget.gocuiSize.h1) {
diff --git a/debug.go b/debug.go
index e6074ca..cf884cf 100644
--- a/debug.go
+++ b/debug.go
@@ -8,7 +8,7 @@ import (
)
func (w *guiWidget) dumpTree(draw bool) {
- log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
+ // log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
if w == nil {
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
return
diff --git a/widget.go b/widget.go
index 9626861..9b3bc5f 100644
--- a/widget.go
+++ b/widget.go
@@ -109,7 +109,7 @@ func (w *guiWidget) SetVisible(b bool) {
func addDropdown() *tree.Node {
n := new(tree.Node)
n.WidgetType = widget.Flag
- n.WidgetId = -2
+ n.WidgetId = 2222
n.ParentId = 0
// store the internal toolkit information
@@ -128,7 +128,9 @@ func addDropdown() *tree.Node {
// add this new widget on the binary tree
tk.parent = me.treeRoot.TK.(*guiWidget)
- if tk.parent != nil {
+ if tk.parent == nil {
+ panic("addDropdown() didn't get treeRoot guiWidget")
+ } else {
tk.parent.children = append(tk.parent.children, tk)
}