work on handling Direction

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-19 18:12:30 -06:00
parent f48b950655
commit d15fa1cf88
4 changed files with 8 additions and 6 deletions

View File

@ -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)

View File

@ -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)
}

View File

@ -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:

View File

@ -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 {