From 7012aff2aebdc74d950d921262e0ddfa677761e4 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 19 Jan 2024 17:08:42 -0600 Subject: hidden settings seem to work Signed-off-by: Jeff Carr --- action.go | 3 ++- box.go | 10 ++++++++++ common.go | 11 +++++++++++ group.go | 2 ++ node.go | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/action.go b/action.go index d2deb94..6db01eb 100644 --- a/action.go +++ b/action.go @@ -56,12 +56,13 @@ func sendAction(n *Node, atype widget.ActionType) { a.State.Pad = n.pad a.State.Expand = n.expand a.State.Borderless = n.borderless - a.State.Direction = n.direction + for s, _ := range n.strings { a.State.Strings = append(a.State.Strings, s) } log.Warn("SENDING ACTION STRINGS a.Strings", a.Strings) + log.Warn("SENDING ACTION a.State.Value", a.State.Value) a.State.Range.Low = n.X a.State.Range.High = n.Y diff --git a/box.go b/box.go index 87276e8..39b64b0 100644 --- a/box.go +++ b/box.go @@ -19,6 +19,16 @@ func (parent *Node) NewBox(progname string, b bool) *Node { return newNode } +func (n *Node) Vertical() *Node { + n.direction = widget.Horizontal + return n +} + +func (n *Node) Horizontal() *Node { + n.direction = widget.Horizontal + return n +} + func (parent *Node) NewHorizontalBox(progname string) *Node { newNode := parent.newNode(progname, widget.Box) newNode.progname = progname diff --git a/common.go b/common.go index a544f51..a46ecb5 100644 --- a/common.go +++ b/common.go @@ -119,6 +119,17 @@ func (n *Node) String() string { if !n.Ready() { return "" } + switch n.WidgetType { + case widget.Window: + return n.label + case widget.Button: + return n.label + case widget.Group: + return n.label + case widget.Label: + return n.label + default: + } return widget.GetString(n.value) } diff --git a/group.go b/group.go index fd47dc1..1a113f1 100644 --- a/group.go +++ b/group.go @@ -13,6 +13,8 @@ func (parent *Node) NewGroup(name string) *Node { newNode.progname = name newNode.label = name + newNode.direction = widget.Vertical + // inform the toolkits sendAction(newNode, widget.Add) return newNode diff --git a/node.go b/node.go index 59eb967..a66ac93 100644 --- a/node.go +++ b/node.go @@ -14,6 +14,10 @@ and it initializes basic default values there isn't much to see here. */ func (n *Node) newNode(title string, t widget.WidgetType) *Node { + if n == nil { + log.Warn("newNode got parent == nil") + log.Exit(0) + } var newN *Node newN = addNode() -- cgit v1.2.3