diff options
Diffstat (limited to 'dropdown.go')
| -rw-r--r-- | dropdown.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/dropdown.go b/dropdown.go index 928ae7d..0d61b74 100644 --- a/dropdown.go +++ b/dropdown.go @@ -134,22 +134,24 @@ func showDDview() error { func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string { w.Hide() - startW, startH := w.Position() - log.Log(GOCUI, "dropdownClicked() start (w,h) =", startW, startH) - log.Log(GOCUI, "dropdownClicked() at (w,h) =", mouseW, mouseH) + // only need height to figure out what line in the dropdown menu the user clicked + _, startH := w.Position() + // startW, startH := w.Position() + // log.Log(GOCUI, "dropdownClicked() start (w,h) =", startW, startH) + // log.Log(GOCUI, "dropdownClicked() at (w,h) =", mouseW, mouseH) itemNumber := mouseH - startH items := strings.Split(w.labelN, "\n") - log.Log(GOCUI, "dropdownClicked() look for item", itemNumber, "len(items) =", len(items)) + // log.Log(GOCUI, "dropdownClicked() look for item", itemNumber, "len(items) =", len(items)) if itemNumber < 1 { return "" } if len(items) >= itemNumber { - log.Log(GOCUI, "dropdownClicked() found", items[itemNumber-1]) + // log.Log(GOCUI, "dropdownClicked() found", items[itemNumber-1]) if items[itemNumber-1] != "" { if me.dropdownW != nil { - log.Log(GOCUI, "dropdownClicked() send event for", me.dropdownW.cuiName, me.dropdownW.node.WidgetType) + // log.Log(GOCUI, "dropdownClicked() send event for", me.dropdownW.cuiName, me.dropdownW.node.WidgetType) me.dropdownW.SetText(items[itemNumber-1]) me.dropdownW.node.SetCurrentS(items[itemNumber-1]) me.myTree.SendUserEvent(me.dropdownW.node) @@ -186,12 +188,12 @@ func dropdownUnclicked(w, h int) { dtext := strings.Join(d.node.Strings(), "\n") tk := me.dropdownV if dtoggle { - log.Log(GOCUI, "dropdownUnclicked() set visible=false") + // log.Log(GOCUI, "dropdownUnclicked() set visible=false") tk.Hide() dtoggle = false tk.SetText("goodbye") } else { - log.Log(GOCUI, "dropdownUnclicked() set visible=true") + // log.Log(GOCUI, "dropdownUnclicked() set visible=true") tk.MoveToOffset(w+doffset, h) tk.SetText(dtext) tk.Show() |
