summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-15 16:14:48 -0600
committerJeff Carr <[email protected]>2024-01-15 16:14:48 -0600
commitaa491036c319beb8326fc422a0efdadf7337cda5 (patch)
tree6e1294823a8a2ec3a79caa55f05a16bcb9bad1f4 /common.go
parent785b6db6e7fc312a18da4352673027c2b91d3789 (diff)
add Destroy()v0.12.9
improve syntax shortcuts go mod update Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'common.go')
-rw-r--r--common.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/common.go b/common.go
index 7430f98..c6397fa 100644
--- a/common.go
+++ b/common.go
@@ -33,13 +33,19 @@ func (n *Node) Hide() *Node {
if ! n.Ready() { return n }
if n.Hidden() { return n }
+
if n.WidgetType == widget.Window {
log.Warn("Hide on a window", n.progname)
log.Warn("this needs to do TestDestroy() ?")
+ n.Destroy()
+ n.hidden = true
+ n.changed = true
+ return nil
}
n.hidden = true
n.changed = true
+
// inform the toolkits
sendAction(n, widget.Hide)
return n
@@ -73,6 +79,18 @@ func (n *Node) Disable() *Node {
return n
}
+func (n *Node) Destroy() {
+ if ! n.Ready() { return }
+ // if ! n.enabled { return }
+
+ n.enabled = false
+ n.changed = true
+
+ // inform the toolkits
+ sendAction(n, widget.Delete)
+ return
+}
+
// add a new text string to widgets that support
// multiple string values
@@ -128,17 +146,17 @@ func (n *Node) GetBool() bool {
}
// should get the reference name used for programming and debugging
-func (n *Node) SetProgName(s string) {
- if ! n.Ready() { return }
+func (n *Node) SetProgName(s string) *Node {
+ if ! n.Ready() { return n }
if n.progname == s {
// don't do anything since nothing changed
- return
+ return n
}
n.changed = true
n.progname = s
- return
+ return n
}
/*