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") log.Println("buttonWindow() START")
w = myGui.NewWindow(title).SetText("Nueva Ventana de Botones") w = myGui.NewWindow(title).SetText("Nueva Ventana de Botones")
t = w.NewTab("buttonTab") t = w.NewTab("buttonTab is this thing")
g = t.NewGroup("buttonGroup") g = t.NewGroup("buttonGroup")
g1 := t.NewGroup("buttonGroup 2") g1 := t.NewGroup("buttonGroup 2")
more = g1.NewGroup("more") more = g1.NewGroup("more")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,8 @@ func (w *cuiWidget) textResize() {
w.showWidgetPlacement(logNow, "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 var err error
if (w.cuiName == "") { if (w.cuiName == "") {
log(logError, "drawView() w.cuiName was not set for widget", w) log(logError, "drawView() w.cuiName was not set for widget", w)