summaryrefslogtreecommitdiff
path: root/click.go
diff options
context:
space:
mode:
Diffstat (limited to 'click.go')
-rw-r--r--click.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/click.go b/click.go
index 59d33b3..c1e91a3 100644
--- a/click.go
+++ b/click.go
@@ -183,9 +183,11 @@ func (w *guiWidget) doWidgetClick() {
case widget.Combobox:
log.Log(NOW, "do the combobox here")
w.showDropdown()
+ me.dropdownW = w
case widget.Dropdown:
log.Log(NOW, "do the dropdown here")
w.showDropdown()
+ me.dropdownW = w
default:
}
}
@@ -221,12 +223,19 @@ func (w *guiWidget) drawTree(draw bool) {
}
func click(g *gocui.Gui, v *gocui.View) error {
- // var l string
- // var err error
+ mouseW, mouseH := me.baseGui.MousePosition()
log.Log(NOW, "click() START gocui name:", v.Name())
- // n := me.rootNode.findWidgetName(v.Name())
w := findUnderMouse()
+
+ // if the dropdown view is visable, process it no matter what
+ if me.dropdownV.Visible() {
+ me.dropdownV.dropdownClicked(mouseW, mouseH)
+ }
+ if w == me.dropdownV {
+ return nil
+ }
+
if w == nil {
log.Error(errors.New("click() could not find widget for view =" + v.Name()))
} else {
@@ -270,12 +279,6 @@ func findUnderMouse() *guiWidget {
var f func(w *guiWidget)
w, h := me.baseGui.MousePosition()
- // if the dropdown view is visable, close it
- if me.dropdownV.Visible() {
- me.dropdownV.dropdownClicked(w, h)
- return me.dropdownV
- }
-
// find buttons that are below where the mouse button click
f = func(widget *guiWidget) {
// ignore widgets that are not visible