fixed errors in Show()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-05 02:22:58 -06:00
parent 8f9e47c117
commit 2ee37e5c20
5 changed files with 29 additions and 13 deletions

3
add.go
View File

@ -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

View File

@ -27,5 +27,5 @@ func (w *guiWidget) setCheckbox() {
// w.gocuiSize.w1 = w.gocuiSize.w0 + t
w.deleteView()
w.showView()
w.Show()
}

View File

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

View File

@ -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)

View File

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