mouse drag was not always right

This commit is contained in:
Jeff Carr 2025-02-08 18:03:11 -06:00
parent 5a84456c7a
commit 82ed687460
4 changed files with 16 additions and 19 deletions

View File

@ -113,22 +113,3 @@ func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
}
return ""
}
/*
func dropdownUnclicked(w, h int) {
var d *guiWidget
// examine everything under X & Y on the screen)
for _, tk := range findByXY(w, h) {
// tk.dumpWidget("dropdownUnclicked()")
if tk.node.WidgetType == widget.Dropdown {
d = tk
}
}
if d == nil {
// 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")
}
*/

View File

@ -70,6 +70,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
// log.Info("mouse down resize off", s)
me.mouse.resize = false
}
win.setAsDragging()
}
return nil
}

10
find.go
View File

@ -200,3 +200,13 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
log.Info("todo: clicked with ctrlDown")
return nil
}
func (tk *guiWidget) findParentWindow() *guiWidget {
if tk.node.WidgetType == widget.Window {
return tk
}
if tk.parent == nil {
return nil
}
return tk.parent.findParentWindow()
}

View File

@ -105,4 +105,9 @@ func textboxClosed() {
// send an event from the plugin with the new string
me.myTree.SendUserEvent(me.textbox.callerTK.node)
win := me.textbox.callerTK.findParentWindow()
if win != nil {
win.dumpWidget("redraw this!!!")
}
}