make keyboard 'f' show what widgets are under the mouse
This commit is contained in:
parent
73de9899a8
commit
bbdf7fefbd
10
junk1.go
10
junk1.go
|
@ -5,6 +5,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/awesome-gocui/gocui"
|
"github.com/awesome-gocui/gocui"
|
||||||
|
@ -99,6 +100,15 @@ func addDebugKeys(g *gocui.Gui) {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// find under mouse
|
||||||
|
g.SetKeybinding("", 'f', gocui.ModNone,
|
||||||
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
w, h := g.MousePosition()
|
||||||
|
for _, tk := range findByXY(w, h) {
|
||||||
|
log.Log(GOCUI, fmt.Sprintf("findByXY() msgDown() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
// hide all widgets
|
// hide all widgets
|
||||||
g.SetKeybinding("", 'h', gocui.ModNone,
|
g.SetKeybinding("", 'h', gocui.ModNone,
|
||||||
func(g *gocui.Gui, v *gocui.View) error {
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
|
@ -75,8 +75,8 @@ func (w *guiWidget) IsCurrent() bool {
|
||||||
return w.isCurrent
|
return w.isCurrent
|
||||||
}
|
}
|
||||||
if w.node.WidgetType == widget.Window {
|
if w.node.WidgetType == widget.Window {
|
||||||
log.Log(GOCUI, "IsCurrent() found current window", w.cuiName, w.String())
|
// log.Log(GOCUI, "IsCurrent() found current window", w.cuiName, w.String())
|
||||||
log.Log(GOCUI, "IsCurrent() window w.isCurrent =", w.isCurrent)
|
// log.Log(GOCUI, "IsCurrent() window w.isCurrent =", w.isCurrent)
|
||||||
return w.isCurrent
|
return w.isCurrent
|
||||||
}
|
}
|
||||||
if w.node.WidgetType == widget.Root {
|
if w.node.WidgetType == widget.Root {
|
||||||
|
@ -125,31 +125,33 @@ func (w *guiWidget) Show() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if w.node.WidgetType == widget.Dropdown {
|
/*
|
||||||
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
if w.node.WidgetType == widget.Dropdown {
|
||||||
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
||||||
}
|
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
||||||
if w.node.WidgetType == widget.Combobox {
|
}
|
||||||
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
if w.node.WidgetType == widget.Combobox {
|
||||||
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
||||||
}
|
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// if the widget is not in the current displayed windo
|
// if the widget is not in the current displayed windo
|
||||||
// then ignore it
|
// then ignore it
|
||||||
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() NOT drawing", w.cuiName, w.String())
|
log.Log(GOCUI, "Show() w.IsCurrent == false. NOT drawing", w.cuiName, w.String())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Log(GOCUI, "Show() drawing", w.cuiName, w.String())
|
|
||||||
|
|
||||||
// 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())
|
||||||
// don't display hidden widgets
|
// don't display hidden widgets
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// log.Log(GOCUI, "Show() doing w.drawView()", w.cuiName, w.String())
|
||||||
// okay, if you made it this far, then display the widget
|
// okay, if you made it this far, then display the widget
|
||||||
w.drawView()
|
w.drawView()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue