summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dropdown.go1
-rw-r--r--eventBindings.go5
-rw-r--r--eventMouseClick.go18
3 files changed, 23 insertions, 1 deletions
diff --git a/dropdown.go b/dropdown.go
index b340168..ee56331 100644
--- a/dropdown.go
+++ b/dropdown.go
@@ -150,6 +150,7 @@ func (tk *guiWidget) showTextbox() {
// updates the text and sends an event back to the application
func (tk *guiWidget) textboxClosed() {
tk.Hide()
+ me.textbox.active = false
// get the text the user entered
newname := tk.GetText()
diff --git a/eventBindings.go b/eventBindings.go
index ad6330f..09bdcbe 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -130,6 +130,11 @@ func doEsc(g *gocui.Gui, v *gocui.View) error {
me.dropdown.active = false
log.Info("escaped from dropdown")
}
+ if me.textbox.active {
+ me.textbox.tk.Hide()
+ me.textbox.active = false
+ log.Info("escaped from textbox")
+ }
return nil
}
diff --git a/eventMouseClick.go b/eventMouseClick.go
index c884ea5..27c6f80 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -120,6 +120,10 @@ func doMouseClick(w int, h int) {
log.Info("got dropdwon click", w, h, tk.cuiName)
tk.dropdownClicked(w, h)
}
+ if tk.node.WidgetId == me.textbox.wId {
+ log.Info("got textbox click", w, h, tk.cuiName)
+ tk.textboxClosed()
+ }
}
return
}
@@ -127,6 +131,17 @@ func doMouseClick(w int, h int) {
// priority widgets. send the click here first
for _, tk := range findByXY(w, h) {
switch tk.node.WidgetType {
+ case widget.Checkbox:
+ if tk.node.State.Checked {
+ log.Log(WARN, "checkbox is being set to false")
+ tk.node.State.Checked = false
+ tk.setCheckbox()
+ } else {
+ log.Log(WARN, "checkbox is being set to true")
+ tk.node.State.Checked = true
+ tk.setCheckbox()
+ }
+ me.myTree.SendUserEvent(tk.node)
case widget.Button:
me.myTree.SendFromUser(tk.node)
return
@@ -140,7 +155,8 @@ func doMouseClick(w int, h int) {
tk.showTextbox()
return
default:
- tk.dumpWidget("undef click()")
+ // TODO: enable the GUI debugger in gocui
+ // tk.dumpWidget("undef click()") // enable this to debug widget clicks
}
}