diff --git a/redo/osxaltest/box.swift b/redo/osxaltest/box.swift index af7c3857..d1e328ac 100644 --- a/redo/osxaltest/box.swift +++ b/redo/osxaltest/box.swift @@ -92,8 +92,12 @@ class Box : NSView, Control { // first collect the views var views = [String: NSView]() var n = 0 + var firstStretchy = -1 for c in self.controls { views["view\(n)"] = c.c.View() + if firstStretchy == -1 && c.stretchy { + firstStretchy = n + } n++ } @@ -104,7 +108,12 @@ class Box : NSView, Control { if self.padded && i != 0 { constraint += "-" } - constraint += "[view\(i)]" + constraint += "[view\(i)" + // implement multiple stretchiness properly + if self.controls[i].stretchy && i != firstStretchy { + constraint += "(==view\(firstStretchy))" + } + constraint += "]" } constraint += "|" var constraints = mkconstraints(constraint, views) diff --git a/redo/osxaltest/main.swift b/redo/osxaltest/main.swift index dd4b439d..aff6f017 100644 --- a/redo/osxaltest/main.swift +++ b/redo/osxaltest/main.swift @@ -16,7 +16,7 @@ func appLaunched() { var box = Box(vertical: firstvert, padded: spaced) mainwin.SetControl(box) - box.Add(Entry(), false) + box.Add(Entry(), true) box.Add(Button("Button"), true) mainwin.Show()