diff options
Diffstat (limited to 'dropdown.go')
| -rw-r--r-- | dropdown.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/dropdown.go b/dropdown.go index 0279041..e8cc6d9 100644 --- a/dropdown.go +++ b/dropdown.go @@ -155,22 +155,22 @@ func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string { return "" } -var dtoggle bool +var dtoggle bool // temporarily tracking show & hide +var doffset int = 5 // how many spaces over the dropdown menu should be from the mouse -func dropdownUnclicked(mouseX, mouseH int) { +func dropdownUnclicked(mouseW, mouseH int) { var d *guiWidget - // log.Log(GOCUI, "dropdownUnclicked() mouseup: got inside me.dropdown handler? wxh =", mouseX, mouseH) + // log.Log(GOCUI, "dropdownUnclicked() mouseup: got inside me.dropdown handler? wxh =", mouseW, mouseH) if me.dropdownV == nil { - log.Log(GOCUI, "mouseUp() dropdownV = nil. you don't have a fake dropdown window to make visible", mouseX, mouseH) + log.Log(GOCUI, "mouseUp() dropdownV = nil. you don't have a fake dropdown window to make visible", mouseW, mouseH) return } - // log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked at apparently (w=%d h=%d)", mouseX, mouseH)) - // log.Log(GOCUI, "dropdownUnclicked() find out what the string is here", mouseX, mouseH, tk.gocuiSize.h1) + // log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked at apparently (w=%d h=%d)", mouseW, mouseH)) + // log.Log(GOCUI, "dropdownUnclicked() find out what the string is here", mouseW, mouseH, tk.gocuiSize.h1) - rootW := me.treeRoot.TK.(*guiWidget) // examine everything under X & Y on the screen) - for i, w := range findByXY(rootW, mouseX, mouseH) { + for i, w := range findByXY(mouseW, mouseH) { log.Log(GOCUI, "dropdownUnclicked()", i, w.WidgetType) if w.WidgetType == widget.Dropdown { d = w @@ -178,7 +178,7 @@ func dropdownUnclicked(mouseX, mouseH int) { } } if d == nil { - log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked() there was no dropdown widget at (w=%d h=%d)", mouseX, mouseH)) + log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked() there was no dropdown widget at (w=%d h=%d)", mouseW, mouseH)) return } log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV") @@ -191,8 +191,9 @@ func dropdownUnclicked(mouseX, mouseH int) { tk.SetText("goodbye") } else { log.Log(GOCUI, "dropdownUnclicked() set visible=true") - tk.Show() + tk.MoveToOffset(mouseW+doffset, mouseH) tk.SetText(dtext) + tk.Show() dtoggle = true } } |
