buttons disabled on window open

This commit is contained in:
Jeff Carr 2025-02-09 06:21:21 -06:00
parent 36745e0492
commit 70452bdaac
3 changed files with 16 additions and 2 deletions

View File

@ -15,7 +15,8 @@ func (tk *guiWidget) doButtonClick() {
tk.dumpWidget("click()") // enable this to debug widget clicks tk.dumpWidget("click()") // enable this to debug widget clicks
me.myTree.SendFromUser(tk.node) me.myTree.SendFromUser(tk.node)
} else { } 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
} }
} }

View File

@ -67,7 +67,12 @@ func addWidget(n *tree.Node) {
tk.color = &colorTab tk.color = &colorTab
return return
case widget.Button: case widget.Button:
tk.setColorButton() if tk.node.IsEnabled() {
tk.setColorButton()
} else {
tk.setColorButton()
tk.setColorDisable()
}
return return
case widget.Checkbox: case widget.Checkbox:
tk.setColorInput() tk.setColorInput()

View File

@ -80,6 +80,14 @@ func (tk *guiWidget) drawView() {
tk.v.Clear() tk.v.Clear()
fmt.Fprint(tk.v, tk.labelN) 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 you don't do this here, it will be black & white only
if tk.color != nil { if tk.color != nil {
tk.v.FrameColor = tk.color.frame tk.v.FrameColor = tk.color.frame