almost quiet

This commit is contained in:
Jeff Carr 2025-01-31 12:36:46 -06:00
parent 5b39848b64
commit f76960c907
5 changed files with 22 additions and 19 deletions

View File

@ -158,27 +158,23 @@ func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
var dtoggle bool // temporarily tracking show & hide var dtoggle bool // temporarily tracking show & hide
var doffset int = 5 // how many spaces over the dropdown menu should be from the mouse var doffset int = 5 // how many spaces over the dropdown menu should be from the mouse
func dropdownUnclicked(mouseW, mouseH int) { func dropdownUnclicked(w, h int) {
var d *guiWidget var d *guiWidget
// log.Log(GOCUI, "dropdownUnclicked() mouseup: got inside me.dropdown handler? wxh =", mouseW, mouseH)
if me.dropdownV == nil { if me.dropdownV == nil {
log.Log(GOCUI, "mouseUp() dropdownV = nil. you don't have a fake dropdown window to make visible", mouseW, mouseH) log.Log(GOCUI, "mouseUp() dropdownV = nil")
return return
} }
// 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)
// examine everything under X & Y on the screen) // examine everything under X & Y on the screen)
for i, w := range findByXY(mouseW, mouseH) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, "dropdownUnclicked()", i, w.WidgetType) // log.Log(GOCUI, fmt.Sprintf("findByXY() (dropdown) %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String()))
if w.WidgetType == widget.Dropdown { if tk.WidgetType == widget.Dropdown {
d = w d = tk
break
} }
} }
if d == nil { if d == nil {
log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked() there was no dropdown widget at (w=%d h=%d)", mouseW, mouseH)) // log.Log(GOCUI, fmt.Sprintf("dropdownUnclicked() there was no dropdown widget at (w=%d h=%d)", mouseW, mouseH))
return return
} }
log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV") log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
@ -191,7 +187,7 @@ func dropdownUnclicked(mouseW, mouseH int) {
tk.SetText("goodbye") tk.SetText("goodbye")
} else { } else {
log.Log(GOCUI, "dropdownUnclicked() set visible=true") log.Log(GOCUI, "dropdownUnclicked() set visible=true")
tk.MoveToOffset(mouseW+doffset, mouseH) tk.MoveToOffset(w+doffset, h)
tk.SetText(dtext) tk.SetText(dtext)
tk.Show() tk.Show()
dtoggle = true dtoggle = true

View File

@ -64,9 +64,12 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
func mouseUp(g *gocui.Gui, v *gocui.View) error { func mouseUp(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition() w, h := g.MousePosition()
for _, tk := range findByXY(w, h) { // useful to debug everything that is being clicked on
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseUp() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) /*
} for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseUp() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
}
*/
dropdownUnclicked(w, h) dropdownUnclicked(w, h)

View File

@ -117,6 +117,10 @@ func click(g *gocui.Gui, v *gocui.View) error {
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() click() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) log.Log(GOCUI, fmt.Sprintf("findByXY() click() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
if tk.WidgetType == widget.Stdout {
// don't send clicks to the stdout debugging window
continue
}
tk.doWidgetClick() tk.doWidgetClick()
return nil return nil
} }

View File

@ -105,7 +105,7 @@ func addDebugKeys(g *gocui.Gui) {
func(g *gocui.Gui, v *gocui.View) error { func(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition() w, h := g.MousePosition()
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() msgDown() %s wId=%d at (%d,%d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) log.Log(GOCUI, fmt.Sprintf("findByXY() 'f' key %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String()))
} }
return nil return nil
}) })

View File

@ -65,7 +65,7 @@ func setupCtrlDownWidget() {
func (w *guiWidget) deleteView() { func (w *guiWidget) deleteView() {
// make sure the view isn't really there // make sure the view isn't really there
log.Log(GOCUI, "deleteView()", w.cuiName, w.WidgetType, w.node.WidgetId) // log.Log(GOCUI, "deleteView()", w.cuiName, w.WidgetType, w.node.WidgetId)
me.baseGui.DeleteView(w.cuiName) me.baseGui.DeleteView(w.cuiName)
w.v = nil w.v = nil
} }
@ -141,13 +141,13 @@ func (w *guiWidget) Show() {
// log.Log(GOCUI, "Show() widget =", w.cuiName, w.String()) // log.Log(GOCUI, "Show() widget =", w.cuiName, w.String())
// log.Log(GOCUI, "Show() w.IsCurrent() returned", w.IsCurrent()) // log.Log(GOCUI, "Show() w.IsCurrent() returned", w.IsCurrent())
if !w.IsCurrent() { if !w.IsCurrent() {
log.Log(GOCUI, "Show() w.IsCurrent == false. NOT drawing", w.cuiName, w.String()) // log.Log(GOCUI, "Show() w.IsCurrent == false. NOT drawing", w.cuiName, w.String())
return return
} }
// finally, check if the widget State is hidden or not // finally, check if the widget State is hidden or not
if w.node.Hidden() { if w.node.Hidden() {
log.Log(GOCUI, "Show() w.node.Hidden() = false. not drawing", w.cuiName, w.String()) // log.Log(GOCUI, "Show() w.node.Hidden() = false. not drawing", w.cuiName, w.String())
// don't display hidden widgets // don't display hidden widgets
return return
} }