From efe4d11576c0dbb0b1e4189274f9908c3eb7e7c3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 3 Apr 2023 16:32:01 -0500 Subject: gocui: more size debugging Signed-off-by: Jeff Carr --- slider.go | 5 ++--- spinner.go | 5 ++--- textbox.go | 5 ++--- toolkit/gocui/click.go | 4 +++- toolkit/gocui/debug.go | 4 +--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/slider.go b/slider.go index 1d2d23d..129930d 100644 --- a/slider.go +++ b/slider.go @@ -13,9 +13,8 @@ func (n *Node) NewSlider(name string, x int, y int) *Node { a.ActionType = toolkit.Add a.X = x a.Y = y - // a.Widget = &newNode.widget - // a.Where = &n.widget - // action(&a) + a.Name = name + a.Text = name newaction(&a, newNode, n) return newNode diff --git a/spinner.go b/spinner.go index 0f48e8f..4b0b3aa 100644 --- a/spinner.go +++ b/spinner.go @@ -13,9 +13,8 @@ func (n *Node) NewSpinner(name string, x int, y int) *Node { a.ActionType = toolkit.Add a.X = x a.Y = y - // a.Widget = &newNode.widget - // a.Where = &n.widget - // action(&a) + a.Name = name + a.Text = name newaction(&a, newNode, n) return newNode diff --git a/textbox.go b/textbox.go index 75703a2..f8208b9 100644 --- a/textbox.go +++ b/textbox.go @@ -11,9 +11,8 @@ func (n *Node) NewTextbox(name string) *Node { var a toolkit.Action a.ActionType = toolkit.Add - // a.Widget = &newNode.widget - // a.Where = &n.widget - // action(&a) + a.Name = name + a.Text = name newaction(&a, newNode, n) return newNode diff --git a/toolkit/gocui/click.go b/toolkit/gocui/click.go index 8e9f2f7..e32825a 100644 --- a/toolkit/gocui/click.go +++ b/toolkit/gocui/click.go @@ -125,7 +125,8 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error { // find buttons that are below where the mouse button click f = func(widget *cuiWidget) { // if ((widget.logicalSize.w0 < w) && (w < widget.logicalSize.w1)) { - if ((widget.realSize.w0 < w) && (w < widget.realSize.w1)) { + if ((widget.realSize.w0 < w) && (w < widget.realSize.w1) && + (widget.realSize.h0 < h) && (h < widget.realSize.h1)) { widgets = append(widgets, widget) found = widget } @@ -151,6 +152,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error { if (found == nil) { found = me.rootNode } + found.updateLogicalSizes() me.ctrlDown.realSize.w0 = found.logicalSize.w0 me.ctrlDown.realSize.w1 = found.logicalSize.w1 me.ctrlDown.realSize.h0 = found.logicalSize.h0 diff --git a/toolkit/gocui/debug.go b/toolkit/gocui/debug.go index e79b1be..0573f70 100644 --- a/toolkit/gocui/debug.go +++ b/toolkit/gocui/debug.go @@ -42,9 +42,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) { return } if (w.parent == nil) { - log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName) - log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName) - log(logError, "showWidgetPlacement() WTF parent == nil", w.id, w.cuiName) + log(logError, "showWidgetPlacement() ERROR parent == nil", w.id, w.cuiName) } log(b, "dump()", s, fmt.Sprintf("(wId,pId)=(%3d,%3d)", w.id, w.parent.id), -- cgit v1.2.3