summaryrefslogtreecommitdiff
path: root/eventMouseClick.go
diff options
context:
space:
mode:
Diffstat (limited to 'eventMouseClick.go')
-rw-r--r--eventMouseClick.go38
1 files changed, 26 insertions, 12 deletions
diff --git a/eventMouseClick.go b/eventMouseClick.go
index 92839a6..c884ea5 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -110,23 +110,37 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
// handles a mouse click
func doMouseClick(w int, h int) {
- dropdownUnclicked(w, h)
-
- /*
- // Flag widgets (dropdown menus, etc) are the highest priority. ALWAYS SEND MOUSE CLICKS THERE FIRST
+ // Flag widgets (dropdown menus, etc) are the highest priority. ALWAYS SEND MOUSE CLICKS THERE FIRST
+ // handle an open dropdown menu or text entry window first
+ if me.dropdown.active || me.textbox.active {
+ // can't drag or do anything when dropdown or textbox are visible
+ log.Info("can't do anything. dropdown or textbox is active")
for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Flag {
- tk.doWidgetClick(w, h)
- return
+ if tk.node.WidgetId == me.dropdown.wId {
+ log.Info("got dropdwon click", w, h, tk.cuiName)
+ tk.dropdownClicked(w, h)
}
}
- */
+ return
+ }
- // Button widgets
+ // priority widgets. send the click here first
for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Button {
- tk.doWidgetClick(w, h)
+ switch tk.node.WidgetType {
+ case widget.Button:
+ me.myTree.SendFromUser(tk.node)
+ return
+ case widget.Combobox:
+ tk.showDropdown()
+ return
+ case widget.Dropdown:
+ tk.showDropdown()
+ return
+ case widget.Textbox:
+ tk.showTextbox()
return
+ default:
+ tk.dumpWidget("undef click()")
}
}
@@ -153,7 +167,7 @@ func doMouseClick(w int, h int) {
func doMouseDoubleClick(w int, h int) {
me.mouse.double = false
- log.Printf("actually a double click (%d,%d)", w, h)
+ // log.Printf("actually a double click (%d,%d)", w, h)
for _, tk := range findByXY(w, h) {
if tk.node.WidgetType == widget.Window {