diff --git a/place.go b/place.go index 4f24c48..03fa579 100644 --- a/place.go +++ b/place.go @@ -8,8 +8,8 @@ import ( "go.wit.com/widget" ) -func (tk *guiWidget) placeBox(startW int, startH int) { - if tk.WidgetType != widget.Box { +func (w *guiWidget) placeBox(startW int, startH int) { + if w.WidgetType != widget.Box { return } // tk.dumpTree("beforebox") @@ -17,21 +17,21 @@ func (tk *guiWidget) placeBox(startW int, startH int) { newW := startW newH := startH - for _, child := range tk.children { + for _, child := range w.children { sizeW, sizeH := child.Size() log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) child.placeWidgets(newW, newH) + // re-get the Size (they should not have changed, but maybe they can?) + // TODO: figure this out or report that they did sizeW, sizeH = child.Size() - if child.node.State.Direction == widget.Vertical { - log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) + if w.node.State.Direction == widget.Vertical { + log.Log(INFO, "BOX IS VERTICAL ", w.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) // expand based on the child height - // something is wrong here - newW += sizeW - } else { - log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) - // expand based on the child width - // something is wrong here newH += sizeH + } else { + log.Log(INFO, "BOX IS HORIZONTAL", w.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) + // expand based on the child width + newW += sizeW } log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) }