diff --git a/toolkit/gocui/debug.go b/toolkit/gocui/debug.go index 770c0c5..91c3d98 100644 --- a/toolkit/gocui/debug.go +++ b/toolkit/gocui/debug.go @@ -59,6 +59,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) { } log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text) + /* if (w.realWidth != (w.gocuiSize.w1 - w.gocuiSize.w0)) { log(b, "dump()", s, "badsize()=(", w.realWidth, ",", w.realHeight, ")", @@ -71,4 +72,5 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) { "badreal()=(", w.gocuiSize.w0, ",", w.gocuiSize.h0, ",", w.gocuiSize.w1, ",", w.gocuiSize.h1, ")", w.widgetType, ",", w.name) } + */ } diff --git a/toolkit/gocui/plugin.go b/toolkit/gocui/plugin.go index c41b558..9cdfffb 100644 --- a/toolkit/gocui/plugin.go +++ b/toolkit/gocui/plugin.go @@ -17,32 +17,31 @@ func (w *cuiWidget) setStartWH() { switch w.widgetType { case toolkit.Root: log(logInfo, "setStartWH() rootNode w.id =", w.id, "w.name", w.name) - w.startW = 1 - w.startH = 1 - w.id = 0 w.isFake = true w.setFake() w.showWidgetPlacement(logNow, "StartWH:") return case toolkit.Flag: - w.startW = 1 - w.startH = 1 w.isFake = true w.setFake() w.showWidgetPlacement(logNow, "StartWH:") return case toolkit.Window: - w.startW = 1 - w.startH = 3 w.setTabWH() w.showWidgetPlacement(logNow, "StartWH:") return case toolkit.Tab: - w.startW = 1 - w.startH = 3 w.setTabWH() w.showWidgetPlacement(logNow, "StartWH:") return + case toolkit.Box: + w.isFake = true + w.setFake() + w.showWidgetPlacement(logNow, "StartWH:") + case toolkit.Grid: + w.isFake = true + w.setFake() + w.showWidgetPlacement(logNow, "StartWH:") } p := w.parent switch p.widgetType { diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go index bd56545..088577b 100644 --- a/toolkit/gocui/tab.go +++ b/toolkit/gocui/tab.go @@ -51,31 +51,27 @@ func (w *cuiWidget) showWidgets() { func (w *cuiWidget) setTabWH() { t := len(w.text) - w.realWidth = t + me.buttonPadding - w.realHeight = me.defaultHeight + w.gocuiSize.width = t + me.buttonPadding + w.gocuiSize.height = me.defaultHeight - startW := 1 - startH := 1 + w.gocuiSize.startW = me.rootNode.startW + w.gocuiSize.startH = me.rootNode.startH for _, child := range me.rootNode.children { if (child.isFake) { continue } if (w == child) { - w.startW = startW - w.startH = startH - w.gocuiSize.startW = startW - w.gocuiSize.startH = startH w.setWH() w.showWidgetPlacement(logNow, "setTABWH:") return } - startW += child.realWidth + w.gocuiSize.startW += child.realWidth } - w.startW = startW - w.startH = startH - w.gocuiSize.startW = startW - w.gocuiSize.startH = startH + + w.startW = me.rootNode.startW + w.startH = me.rootNode.startH + me.buttonPadding + w.setWH() w.showWidgetPlacement(logNow, "setTabWH:") }