summaryrefslogtreecommitdiff
path: root/dropdown.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-31 10:28:08 -0600
committerJeff Carr <[email protected]>2025-01-31 13:47:45 -0600
commitc348940ca1367e9c64560812b12fbde27f7ad17e (patch)
tree90b074519e25d52d1d9689e3549d1b50363d2db8 /dropdown.go
parent8a4afa760d1817e3f796fd2c8e6c3e5c01e59f5a (diff)
comments and code rearrangement
Diffstat (limited to 'dropdown.go')
-rw-r--r--dropdown.go21
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
}
}