hidden settings seem to work

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-19 17:08:42 -06:00
parent 4ef833479c
commit 7012aff2ae
5 changed files with 29 additions and 1 deletions

View File

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

10
box.go
View File

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

View File

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

View File

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

View File

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