From 51b109a976979ff4b1301d65a66722919195bb77 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 8 Apr 2023 09:17:17 -0500 Subject: [PATCH] more code deprecation Signed-off-by: Jeff Carr --- cmds/buttonplugin/main.go | 2 +- common.go | 32 +++++++++++++++++++------------- window.go | 4 ++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/cmds/buttonplugin/main.go b/cmds/buttonplugin/main.go index c4b9064..64500bb 100644 --- a/cmds/buttonplugin/main.go +++ b/cmds/buttonplugin/main.go @@ -48,7 +48,7 @@ func buttonWindow() { log.Println("buttonWindow()") log.Println("buttonWindow()") - w = myGui.NewWindow2(title) + w = myGui.NewWindow2(title).SetText("Nueva Ventana de Botones") t = w.NewTab("buttonTab") g = t.NewGroup("buttonGroup") g1 := t.NewGroup("buttonGroup 2") diff --git a/common.go b/common.go index 3943f61..367b785 100644 --- a/common.go +++ b/common.go @@ -52,7 +52,7 @@ func (n *Node) AddText(str string) { newaction(&a, n, nil) } -func (n *Node) SetText(text string) { +func (n *Node) SetText(text string) *Node{ log(debugChange, "SetText() value =", text) n.Text = text @@ -60,6 +60,7 @@ func (n *Node) SetText(text string) { a.ActionType = toolkit.SetText a.S = text newaction(&a, n, nil) + return n } func (n *Node) SetNext(x int, y int) { @@ -154,52 +155,57 @@ func commonCallback(n *Node) { } } -func (n *Node) Margin() { +func (n *Node) Margin() *Node { var a toolkit.Action a.ActionType = toolkit.Margin newaction(&a, n, nil) + return n } -func (n *Node) Unmargin() { +func (n *Node) Unmargin() *Node { var a toolkit.Action a.ActionType = toolkit.Unmargin newaction(&a, n, nil) + return n } -func (n *Node) Pad() { +func (n *Node) Pad() *Node { var a toolkit.Action a.ActionType = toolkit.Pad newaction(&a, n, nil) + return n } -func (n *Node) Unpad() { +func (n *Node) Unpad() *Node { var a toolkit.Action a.ActionType = toolkit.Unpad newaction(&a, n, nil) + return n } // is this better? +// yes, this is better. it allows Internationalization very easily // me.window = myGui.New2().Window("DNS and IPv6 Control Panel").Standard() +// myFunnyWindow = myGui.New().Window("Hello").Standard().SetText("Hola") func (n *Node) New2() *Node { - var newWin *Node - newWin = NewWindow() - log(debugError, "New2() END Main(f)") - return newWin + log(debugNow, "New2() Start") + return n.NewWindow2("New2") } func (n *Node) Window(title string) *Node { log(debugError, "Window()", n) - n.SetText(title) - return n + return n.NewWindow2(title) } +// This should not really do anything. as per the docs, the "Standard()" way +// should be the default way func (n *Node) Standard() *Node { - log(debugError, "Standard()") + log(debugError, "Standard() not implemented yet") return n } func (n *Node) DoMargin() *Node { - log(debugError, "DoMargin()") + log(debugError, "DoMargin() not implemented yet") return n } diff --git a/window.go b/window.go index 2935043..95cb92c 100644 --- a/window.go +++ b/window.go @@ -61,8 +61,8 @@ func (n *Node) NewWindow2(title string) *Node { a.ActionType = toolkit.Add a.Width = Config.Width a.Height = Config.Height - a.Name = Config.Title - a.Text = Config.Title + a.Name = title + a.Text = title newaction(&a, newNode, n) return newNode