PopUpList.st
changeset 1368 5fcf20b3d507
parent 1311 5230e0dfbb27
child 1369 d65ca0b910b1
--- a/PopUpList.st	Wed Oct 29 17:12:41 1997 +0100
+++ b/PopUpList.st	Wed Oct 29 17:13:04 1997 +0100
@@ -421,17 +421,22 @@
 defaultLabel:aString
     "set the defaultLabel, to be shown if nothing is selected"
 
-    defaultLabel := aString
+    defaultLabel := aString.
+    shown ifFalse:[
+        super label:defaultLabel
+    ].
+
+    "Modified: / 29.10.1997 / 15:50:10 / cg"
 !
 
 label:aString
     self defaultLabel:aString.
     model isNil ifTrue:[
-        super label:aString
+        super label:aString suppressResize:(self shown)
     ].
 
-    "Created: 1.3.1997 / 02:09:02 / cg"
-    "Modified: 1.3.1997 / 02:11:03 / cg"
+    "Created: / 1.3.1997 / 02:09:02 / cg"
+    "Modified: / 29.10.1997 / 15:49:50 / cg"
 !
 
 list
@@ -461,12 +466,13 @@
     "set (force) a selection - usually done to set
      an initial selection without updating others"
 
-    |index wasFix|
+    |index menuLabels|
 
     menu isNil ifTrue:[
         self getListFromModel.
     ].
     menu isNil ifTrue:[^ self].
+    menuLabels := menu labels.
 
     (useIndex not and:[values notNil]) ifTrue:[
         index := values indexOf:indexOrString
@@ -474,20 +480,22 @@
         indexOrString isNumber ifTrue:[
             index := indexOrString
         ] ifFalse:[
-            index := menu labels indexOf:indexOrString.
+            index := menuLabels indexOf:indexOrString.
         ].
         "/ fails if list consists of symbols ...
         "/ index := menu indexOf:indexOrString.
     ].
+    index > menuLabels size ifTrue:[
+        index := 0
+    ].
+
     index == 0 ifTrue:[
-        super label:defaultLabel.
+        self label:defaultLabel suppressResize:true.
         ^ self
     ].
 
     "kludge: dont want label to resize ..."
-    wasFix := fixSize. fixSize := true.
-    super label:(menu labels at:index) printString.
-    fixSize := wasFix
+    self label:(menuLabels at:index) printString suppressResize:true.
 
     "
      |p|
@@ -510,7 +518,7 @@
      p open
     "
 
-    "Modified: 1.3.1997 / 02:12:24 / cg"
+    "Modified: / 29.10.1997 / 15:50:12 / cg"
 !
 
 values:aList
@@ -893,12 +901,16 @@
 select:anIndex
     "this is sent from the popupmenu when an entry was selected"
 
-    |value label chg|
+    |value menuLabels label chg|
 
+anIndex printCR.
+    menuLabels := menu labels.
     values isNil ifTrue:[
         value := anIndex.
         useIndex ifFalse:[
-            value := menu labels at:anIndex.
+useIndex printCR.
+            value := menuLabels at:anIndex.
+anIndex printCR.
         ]
     ] ifFalse:[
         value := values at:anIndex
@@ -908,9 +920,9 @@
         "/ if there is a model,
         "/ the update will change my logo ...
 
-        self sizeFixed:true.
-        label := menu labels at:anIndex.
-        super label:label printString.
+        "/ self sizeFixed:true.
+        label := menuLabels at:anIndex.
+        super label:label printString suppressResize:true.
 "/    ].
 
     (model notNil and:[changeMsg notNil]) ifTrue:[
@@ -931,6 +943,7 @@
             ]
         ].
 
+value printCR.
         self sendChangeMessage:chg with:value.
     ].
 
@@ -941,11 +954,11 @@
         menuAction value:value.
     ].
 
-    "Modified: 19.3.1997 / 17:59:04 / cg"
+    "Modified: / 29.10.1997 / 15:50:18 / cg"
 ! !
 
 !PopUpList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.51 1997-08-26 15:38:03 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.52 1997-10-29 16:13:04 cg Exp $'
 ! !