From 12f3d5ac5cb4add74eb9a053ae1804c661654d09 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 5 Feb 2025 07:24:14 -0600 Subject: set the node.State.Label on SetText() --- debug.go | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'debug.go') diff --git a/debug.go b/debug.go index 86c71a4..c4bd911 100644 --- a/debug.go +++ b/debug.go @@ -6,6 +6,7 @@ package main import ( "fmt" + "github.com/awesome-gocui/gocui" "go.wit.com/log" "go.wit.com/widget" ) @@ -29,7 +30,7 @@ func (tk *guiWidget) dumpWidget(s string) { var pId int // tk.verifyRect() if tk.node.Parent == nil { - log.Log(INFO, "showWidgetPlacement() parent == nil", tk.node.WidgetId, tk.cuiName) + log.Logf(WARN, "showWidgetPlacement() parent == nil wId=%d cuiName=%s", tk.node.WidgetId, tk.cuiName) pId = 0 } else { pId = tk.node.Parent.WidgetId @@ -63,5 +64,30 @@ func (tk *guiWidget) dumpWidget(s string) { } end = fmt.Sprintf("%5s %-8s %s", tk.cuiName, tk.node.WidgetType, tk.String()) } - log.Log(NOW, s1, s, end) + log.Log(GOCUI, s1, s, end) +} + +func printWidgetTree(g *gocui.Gui, v *gocui.View) error { + me.treeRoot.ListWidgets() + + tk := me.logStdout + // msg := fmt.Sprintf("test out kb %d\n", ecount) + // tk.Write([]byte(msg)) + if tk == nil { + log.Log(ERROR, "tk = nil") + } + if tk.v == nil { + log.Log(ERROR, "tk.v = nil") + } else { + log.Log(ERROR, "setting log.CaptureMode(tk.v)") + log.Log(ERROR, "setting log.CaptureMode(tk.v)") + log.CaptureMode(tk) + } + return nil +} + +func printWidgetPlacements(g *gocui.Gui, v *gocui.View) error { + w := me.treeRoot.TK.(*guiWidget) + w.dumpTree("MM") + return nil } -- cgit v1.2.3