gocui: closer to correct tabs

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-26 12:38:39 -05:00
parent 051ad00de3
commit e750b06831
8 changed files with 18 additions and 15 deletions

View File

@ -35,7 +35,7 @@ func buttonWindow() {
log.Println("buttonWindow() START")
w = myGui.NewWindow(title).SetText("Nueva Ventana de Botones")
t = w.NewTab("buttonTab")
t = w.NewTab("buttonTab is this thing")
g = t.NewGroup("buttonGroup")
g1 := t.NewGroup("buttonGroup 2")
more = g1.NewGroup("more")

View File

@ -28,7 +28,7 @@ func (w *cuiWidget) setFake() {
fakeStartWidth += me.DevelOffsetW
}
if (logInfo) {
w.drawView()
w.showView()
}
}
@ -45,11 +45,11 @@ func (w *cuiWidget) addWidget() {
return
case toolkit.Window:
w.setTabWH()
w.drawView()
w.showView()
return
case toolkit.Tab:
w.setTabWH()
w.drawView()
w.showView()
return
case toolkit.Box:
w.isFake = true

View File

@ -28,5 +28,5 @@ func (w *cuiWidget) setCheckbox(b bool) {
}
w.deleteView()
w.drawView()
w.showView()
}

View File

@ -50,6 +50,8 @@ func (w *cuiWidget) doWidgetClick() {
w.showWidgets()
// THIS IS THE BEGINING OF THE LAYOUT
case toolkit.Tab:
UnsetCurrent(me.rootNode)
me.rootNode.hideWidgets()
w.isCurrent = true
w.parent.isCurrent = true
@ -120,7 +122,7 @@ func (w *cuiWidget) drawTree(draw bool) {
w.showWidgetPlacement(logNow, "drawTree()")
if (draw) {
// w.textResize()
w.drawView()
w.showView()
} else {
w.deleteView()
}
@ -219,7 +221,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
if (me.ctrlDown.v == nil) {
me.ctrlDown.text = found.text
me.ctrlDown.showWidgetPlacement(logNow, "ctrlDown:")
me.ctrlDown.drawView()
me.ctrlDown.showView()
} else {
me.ctrlDown.deleteView()
}

View File

@ -27,7 +27,7 @@ func action(a *toolkit.Action) {
}
case toolkit.Show:
if (a.B) {
w.drawView()
w.showView()
} else {
w.hideWidgets()
}
@ -71,7 +71,7 @@ func (w *cuiWidget) SetText(text string) {
w.s = text
w.textResize()
w.deleteView()
w.drawView()
w.showView()
}
func (w *cuiWidget) Set(val any) {

View File

@ -58,7 +58,7 @@ type config struct {
WindowW int `default:"8" dense:"0"`
WindowH int `default:"-1"`
TabW int `default:"2" dense:"0"`
TabH int `default:"2" dense:"0"`
TabH int `default:"1" dense:"0"`
// additional amount of space to indent on a group
GroupPadW int `default:"6" dense:"2"`

View File

@ -37,7 +37,7 @@ func (w *cuiWidget) showFake() {
if (w.isFake) {
w.setFake()
w.showWidgetPlacement(logNow, "showFake:")
w.drawView()
w.showView()
}
for _, child := range w.children {
child.showFake()
@ -50,7 +50,7 @@ func (w *cuiWidget) showWidgets() {
} else {
if w.IsCurrent() {
w.showWidgetPlacement(logNow, "current:")
w.drawView()
w.showView()
} else {
w.showWidgetPlacement(logNow, "not:")
// w.drawView()
@ -121,12 +121,12 @@ func (w *cuiWidget) redoTabs(draw bool) {
}
w.setWindowWH()
w.deleteView()
w.drawView()
w.showView()
}
if (w.widgetType == toolkit.Tab) {
w.setTabWH()
w.deleteView()
w.drawView()
w.showView()
}
for _, child := range w.children {

View File

@ -35,7 +35,8 @@ func (w *cuiWidget) textResize() {
w.showWidgetPlacement(logNow, "textResize()")
}
func (w *cuiWidget) drawView() {
// display's the text of the widget in gocui
func (w *cuiWidget) showView() {
var err error
if (w.cuiName == "") {
log(logError, "drawView() w.cuiName was not set for widget", w)