summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-09 06:21:21 -0600
committerJeff Carr <[email protected]>2025-02-09 06:21:21 -0600
commit70452bdaac9a558c6266f1f46121222c38e17487 (patch)
treea75f884f8b7b50cbdd180580c9a27a3dee174033
parent36745e0492d52bf337f5e6db1ab52912511ec010 (diff)
buttons disabled on window open
-rw-r--r--eventMouseClick.go3
-rw-r--r--treeAdd.go7
-rw-r--r--treeDraw.go8
3 files changed, 16 insertions, 2 deletions
diff --git a/eventMouseClick.go b/eventMouseClick.go
index ce0b6a6..9e4aa1e 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -15,7 +15,8 @@ func (tk *guiWidget) doButtonClick() {
tk.dumpWidget("click()") // enable this to debug widget clicks
me.myTree.SendFromUser(tk.node)
} else {
- tk.dumpWidget("disabled()") // enable this to debug widget clicks
+ log.Info("button is currently disabled by the application")
+ // tk.dumpWidget("disabled()") // enable this to debug widget clicks
}
}
diff --git a/treeAdd.go b/treeAdd.go
index d20da80..766e373 100644
--- a/treeAdd.go
+++ b/treeAdd.go
@@ -67,7 +67,12 @@ func addWidget(n *tree.Node) {
tk.color = &colorTab
return
case widget.Button:
- tk.setColorButton()
+ if tk.node.IsEnabled() {
+ tk.setColorButton()
+ } else {
+ tk.setColorButton()
+ tk.setColorDisable()
+ }
return
case widget.Checkbox:
tk.setColorInput()
diff --git a/treeDraw.go b/treeDraw.go
index f1e9b95..802e498 100644
--- a/treeDraw.go
+++ b/treeDraw.go
@@ -80,6 +80,14 @@ func (tk *guiWidget) drawView() {
tk.v.Clear()
fmt.Fprint(tk.v, tk.labelN)
+ // tmp hack to disable buttons on window open
+ if tk.node.WidgetType == widget.Button {
+ if tk.node.IsEnabled() {
+ } else {
+ tk.setColorDisable()
+ }
+ }
+
// if you don't do this here, it will be black & white only
if tk.color != nil {
tk.v.FrameColor = tk.color.frame