summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-05 02:22:58 -0600
committerJeff Carr <[email protected]>2024-02-05 02:22:58 -0600
commit2ee37e5c209f64a09d4088b8895880deb084d0ee (patch)
tree53de73862e9ccbdef981e90a4c09edf183d01e25
parent8f9e47c11711b629ff7351c0626c85d3e8aa0979 (diff)
fixed errors in Show()
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--add.go3
-rw-r--r--checkbox.go2
-rw-r--r--click.go2
-rw-r--r--plugin.go1
-rw-r--r--widget.go34
5 files changed, 29 insertions, 13 deletions
diff --git a/add.go b/add.go
index 54a1134..f7a0749 100644
--- a/add.go
+++ b/add.go
@@ -23,9 +23,6 @@ func setFake(n *tree.Node) {
fakeStartHeight = me.TabH
fakeStartWidth += me.FakeW
}
- if true {
- w.showView()
- }
}
// set the widget start width & height
diff --git a/checkbox.go b/checkbox.go
index b352758..8c4b3db 100644
--- a/checkbox.go
+++ b/checkbox.go
@@ -27,5 +27,5 @@ func (w *guiWidget) setCheckbox() {
// w.gocuiSize.w1 = w.gocuiSize.w0 + t
w.deleteView()
- w.showView()
+ w.Show()
}
diff --git a/click.go b/click.go
index 431d27d..254d079 100644
--- a/click.go
+++ b/click.go
@@ -38,7 +38,7 @@ func (w *guiWidget) doWidgetClick() {
// now set this window as the current window
me.currentWindow = w
- w.isCurrent = true
+ me.currentWindow.isCurrent = true
// draw the current window
log.Log(NOW, "doWidgetClick() set currentWindow to", w.String())
diff --git a/plugin.go b/plugin.go
index 37d9f9b..b9ff8ee 100644
--- a/plugin.go
+++ b/plugin.go
@@ -51,7 +51,6 @@ func action(a widget.Action) {
log.Log(INFO, "Setting Visible to true", a.ProgName)
w.SetVisible(true)
}
- w.showView()
case widget.Hide:
w.node.State.Hidden = true
log.Log(NOW, "HIDE HERE. a.State.Hidden =", a.State.Hidden)
diff --git a/widget.go b/widget.go
index d87d35e..ee6a12d 100644
--- a/widget.go
+++ b/widget.go
@@ -65,12 +65,6 @@ func setupCtrlDownWidget() {
}
func (w *guiWidget) deleteView() {
- /*
- if w.v != nil {
- w.v.Visible = false
- return
- }
- */
// make sure the view isn't really there
log.Log(NOW, "deleteView()", w.cuiName, w.WidgetType, w.node.WidgetId)
me.baseGui.DeleteView(w.cuiName)
@@ -82,6 +76,8 @@ func (w *guiWidget) IsCurrent() bool {
return w.isCurrent
}
if w.node.WidgetType == widget.Window {
+ log.Log(NOW, "IsCurrent() found current window", w.cuiName, w.String())
+ log.Log(NOW, "IsCurrent() window w.isCurrent =", w.isCurrent)
return w.isCurrent
}
if w.node.WidgetType == widget.Root {
@@ -106,9 +102,33 @@ func (tk *guiWidget) Visible() bool {
}
func (tk *guiWidget) Show() {
- if tk.IsCurrent() {
+ // always should the dropdown widget
+ if tk == me.dropdownV {
+ me.dropdownV.showView()
+ return
+ }
+ // if this isn't in the binary tree
+ // it's some internal widget so always display those
+ if tk.node == nil {
tk.showView()
+ return
+ }
+
+ // if the widget is not in the current displayed windo
+ // then ignore it
+ log.Log(NOW, "Show() tk =", tk.cuiName, tk.String())
+ log.Log(NOW, "Show() tk.IsCurrent() returned", tk.IsCurrent())
+ if ! tk.IsCurrent() {
+ log.Log(NOW, "Show() NOT drawing", tk.cuiName, tk.String())
+ return
+ }
+ log.Log(NOW, "Show() drawing", tk.cuiName, tk.String())
+
+ // finally, check if the widget State is hidden or not
+ if tk.node.State.Hidden {
+ // don't display hidden widgets
} else {
+ tk.showView()
}
}