fixed preferredExtent to also look into the menus list
authorca
Mon, 26 Jan 1998 19:56:40 +0100
changeset 683 a2593b4a3ce1
parent 682 861e446e3b24
child 684 707ce2f663f0
fixed preferredExtent to also look into the menus list (in case, it contains labelAndIcons ...)
ComboView.st
--- a/ComboView.st	Mon Jan 26 19:55:55 1998 +0100
+++ b/ComboView.st	Mon Jan 26 19:56:40 1998 +0100
@@ -443,7 +443,7 @@
 preferredExtent
     "compute & return the boxes preferredExtent from the components' preferrences"
 
-    |fieldPref buttonPref m menuPrefX w h|
+    |fieldPref buttonPref m menuPrefX menuPrefY w h|
 
     "/ If I have an explicit preferredExtent ..
 
@@ -456,10 +456,11 @@
     ].
 
     list isNil ifTrue:[
-        menuPrefX := 0
+        menuPrefX := menuPrefY := 0
     ] ifFalse:[
         m := MenuView labels:list.
         menuPrefX := m preferredExtent x.
+        menuPrefY := (m preferredExtentForLines:1 cols:10) y
     ].
 
     fieldPref := field preferredExtent.
@@ -467,7 +468,7 @@
 
     w := ((fieldPref x max:menuPrefX) max:50) + buttonPref x.
     w := w + margin + margin.
-    h := fieldPref y max:buttonPref y.
+    h := (fieldPref y max:buttonPref y) max:menuPrefY.
     h := h + margin + margin.
     ^ w @ h
 
@@ -523,5 +524,5 @@
 !ComboView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ComboView.st,v 1.35 1997-11-03 15:13:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ComboView.st,v 1.36 1998-01-26 18:56:40 ca Exp $'
 ! !