From 8fcf5f668b182bd382b489cd19cfdcd59628b279 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 5 Feb 2024 12:15:30 -0600 Subject: minor changes for v0.20 Signed-off-by: Jeff Carr --- setText.go | 8 ++++++++ watchdog.go | 12 ++---------- window.go | 14 +++++++++++++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/setText.go b/setText.go index 644fe5f..c1baf88 100644 --- a/setText.go +++ b/setText.go @@ -16,6 +16,10 @@ func (n *Node) SetLabel(label string) *Node { n.label = label case widget.Button: n.label = label + case widget.Combobox: + n.label = label + case widget.Dropdown: + n.label = label case widget.Label: n.label = label case widget.Group: @@ -49,6 +53,10 @@ func (n *Node) SetText(text string) *Node { n.label = text case widget.Group: n.label = text + case widget.Combobox: + n.label = text + case widget.Dropdown: + n.label = text case widget.Window: n.label = text default: diff --git a/watchdog.go b/watchdog.go index 07a1dee..121e91b 100644 --- a/watchdog.go +++ b/watchdog.go @@ -10,21 +10,13 @@ var watchtime time.Duration = 100 // in tenths of seconds /* This program sits here. -If you exit here, the whole thing will os.Exit() -TODO: use Ticker - This goroutine can be used like a watchdog timer +TODO: handle toolkit panics here? */ func Watchdog() { var i = 1 - /* - for { - log.Verbose("gui.Watchdog() is alive. give me something to do.", i) - time.Sleep(watchtime * time.Second / 10) - } - */ // check the four known things to see if they are all WORKING - myTicker(3*time.Second, "WATCHDOG", func() { + myTicker(10*time.Second, "WATCHDOG", func() { i += 1 log.Log(INFO, "myTicker() ticked", i) }) diff --git a/window.go b/window.go index de507a4..78fb188 100644 --- a/window.go +++ b/window.go @@ -5,7 +5,19 @@ import ( "go.wit.com/widget" ) -// This routine creates a blank window with a Title and size (W x H) +// Why have NewWindow() when there isn't just Window() +// That's how smalltalk did things in 1972. Keep it Simple. +// todo: remove 'New' from every function name +// will that work? Are there problems with that? +// Button() Grid() Box(), Label() +// 2024/01/04 Naw, having NewWindow is more readable +/* +func (parent *Node) Window(title string) *Node { + return parent.NewWindow(title) +} +*/ + +// This routine creates a blank window with a Title func (parent *Node) NewWindow(title string) *Node { var newNode *Node -- cgit v1.2.3