YesNoBox.st
changeset 6364 0524033012d2
parent 6331 08ac4c72de00
child 6502 1e36a7f321dc
--- a/YesNoBox.st	Fri Jun 29 10:04:07 2018 +0200
+++ b/YesNoBox.st	Sun Jul 01 09:53:55 2018 +0200
@@ -253,7 +253,7 @@
 preferredExtent
     "compute the boxes preferredExtent from the components' sizes"
 
-    |w h max mm|
+    |w h max mm nButtons|
 
     "/ If I have an explicit preferredExtent..
     explicitExtent notNil ifTrue:[
@@ -270,12 +270,25 @@
     "
      make the two buttons of equal size
     "
-    max := okButton preferredWidth max:abortButton preferredWidth.
+    nButtons := 2.
+    max := 0.
+    buttonPanel notNil ifTrue:[ 
+        max := buttonPanel subViews 
+                    inject:0 
+                    into:[:maxSoFar :button |
+                        maxSoFar max:button preferredWidth
+                    ].
+        nButtons := buttonPanel subViews size.           
+    ].                
+    max := max max:(okButton preferredWidth max:abortButton preferredWidth).
     okButton width:max.
     abortButton width:max.
-
-    w := (formLabel width + textLabel width) max:(max * 2).
-    w := w + (3 * mm) + ((okButton borderWidth + abortButton borderWidth) * 2).
+    buttonPanel notNil ifTrue:[
+        buttonPanel subViews do:[:each | each width:max].
+    ].
+    
+    w := (formLabel width + textLabel width) max:(max * nButtons).
+    w := w + ((nButtons+1) * mm) + ((okButton borderWidth + abortButton borderWidth) * nButtons).
     w := w max:self maxPreferredWidthOfAddedComponents.
 
     h := (mm * 5)
@@ -287,6 +300,7 @@
 
     "Modified: / 19-07-1996 / 20:45:53 / cg"
     "Modified (format): / 20-06-2017 / 10:37:44 / cg"
+    "Modified: / 01-07-2018 / 09:53:09 / Claus Gittinger"
 ! !
 
 !YesNoBox methodsFor:'startup'!