From d15fa1cf88cc7652b70217906155bde2c0e6f5d6 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 19 Jan 2024 18:12:30 -0600 Subject: [PATCH] work on handling Direction Signed-off-by: Jeff Carr --- action.go | 1 + place.go | 1 + setText.go | 10 +++++----- window.go | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/action.go b/action.go index db83624..42b0fbe 100644 --- a/action.go +++ b/action.go @@ -231,6 +231,7 @@ func processAction(a *widget.Action) { case widget.Set: setText(n, a) case widget.SetText: + log.Warn("andlabs SetText wid =", n.WidgetId, n.State.Value, a.State.Value) setText(n, a) case widget.AddText: addText(n, a) diff --git a/place.go b/place.go index 79eb580..62b9fe0 100644 --- a/place.go +++ b/place.go @@ -72,6 +72,7 @@ func place(p *tree.Node, n *tree.Node) bool { case widget.Group: if ptk.uiBox == nil { log.Log(WARN, "place() andlabs hack group to use add a box", n.GetProgName(), n.WidgetType) + n.State.Direction = widget.Vertical ptk.uiBox = rawBox(n) ptk.uiGroup.SetChild(ptk.uiBox) } diff --git a/setText.go b/setText.go index 4084028..30ee24a 100644 --- a/setText.go +++ b/setText.go @@ -22,12 +22,12 @@ func setText(n *tree.Node, a *widget.Action) { switch n.WidgetType { case widget.Window: log.Warn("setText() Attempt to set the title to", name) - tk.uiWindow.SetTitle(name) + tk.uiWindow.SetTitle(a.State.Label) case widget.Tab: case widget.Group: - tk.uiGroup.SetTitle(name) + tk.uiGroup.SetTitle(a.State.Label) case widget.Checkbox: - tk.uiCheckbox.SetText(name) + tk.uiCheckbox.SetText(a.State.Label) case widget.Textbox: if tk.uiEntry != nil { tk.uiEntry.SetText(name) @@ -36,9 +36,9 @@ func setText(n *tree.Node, a *widget.Action) { tk.uiMultilineEntry.SetText(name) } case widget.Label: - tk.uiLabel.SetText(name) + tk.uiLabel.SetText(a.State.Label) case widget.Button: - tk.uiButton.SetText(name) + tk.uiButton.SetText(a.State.Label) case widget.Slider: log.Log(ERROR, "setText() on slider unknown", a.ActionType, "on checkbox", n.GetProgName()) case widget.Spinner: diff --git a/window.go b/window.go index 804c1aa..744c951 100644 --- a/window.go +++ b/window.go @@ -20,7 +20,7 @@ func newWindow(p, n *tree.Node) { newt = new(guiWidget) // bool == false is if the OS defined border on the window should be used - win := ui.NewWindow(n.GetProgName(), 640, 480, n.State.Borderless) + win := ui.NewWindow(n.GetProgName(), 40, 40, n.State.Borderless) win.SetBorderless(n.State.Borderless) win.SetMargined(n.State.Pad) win.OnClosing(func(*ui.Window) bool {