diff options
| author | Jeff Carr <[email protected]> | 2024-02-05 02:22:58 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-05 02:22:58 -0600 |
| commit | 2ee37e5c209f64a09d4088b8895880deb084d0ee (patch) | |
| tree | 53de73862e9ccbdef981e90a4c09edf183d01e25 | |
| parent | 8f9e47c11711b629ff7351c0626c85d3e8aa0979 (diff) | |
fixed errors in Show()
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | add.go | 3 | ||||
| -rw-r--r-- | checkbox.go | 2 | ||||
| -rw-r--r-- | click.go | 2 | ||||
| -rw-r--r-- | plugin.go | 1 | ||||
| -rw-r--r-- | widget.go | 34 |
5 files changed, 29 insertions, 13 deletions
@@ -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() } @@ -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()) @@ -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) @@ -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() } } |
