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