#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Thu, 20 Feb 2020 10:10:39 +0100
changeset 6827 71d47cbb79ed
parent 6826 afd3d1c1cc86
child 6828 7795234a7575
#FEATURE by exept class: MultiColumnPanelView changed: #setChildPositions class: MultiColumnPanelView class comment/format in: #examples
MultiColumnPanelView.st
--- a/MultiColumnPanelView.st	Wed Feb 19 21:11:04 2020 +0100
+++ b/MultiColumnPanelView.st	Thu Feb 20 10:10:39 2020 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -111,13 +113,12 @@
 
 examples
 "
-    These examples demonstrate the effect of different layout
-    settings.
+    These examples demonstrate the effect of different layout settings.
     You should try more examples, combining spacing and different
     verticalLayout:/horizontalLayout: combinations.
 
 
-    example: default layout (centered)
+    example: default layout and columns made to fit
                                                                         [exBegin]
         |v p b1 b2 b3 l1 l2 l3|
 
@@ -135,6 +136,24 @@
         v extent:100 @ 300.
         v open
                                                                         [exEnd]
+
+                                                                        [exBegin]
+        |v p b1 b2 b3 l1 l2 l3|
+
+        v := StandardSystemView new.
+        v label:'center (default)'.
+        p := MultiColumnPanelView in:v.
+        p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+        p horizontalLayout:#fitSpace.
+        l1 := Label label:'label1' in:p.
+        b1 := Button label:'button1' in:p.
+        l2 := Label label:'l2' in:p.
+        b2 := Button label:'b2' in:p.
+        l3 := Label label:'lab3' in:p.
+        b3 := Button label:'butt3' in:p.
+        v extent:100 @ 300.
+        v open
+                                                                        [exEnd]
 "
 ! !
 
@@ -326,8 +345,12 @@
         cY := ypos + maxHeight.
 
         child origin:(xpos@ypos)"corner:(cX @ cY)".
-        hLayout == #fit ifTrue:[
+        (hLayout == #fit) ifTrue:[
             child width:(cX - xpos + 1).
+        ] ifFalse:[
+            (hLayout == #fitSpace) ifTrue:[
+                child width:(cX - xpos + 1 - horizontalSpace).
+            ].
         ].
         col := col + 1.
         col > numCols ifTrue:[