PopUpList.st
changeset 1839 75f77fcf458b
parent 1772 7ac24130dd51
child 1840 4f19e7d33159
--- a/PopUpList.st	Sun Apr 11 12:25:33 1999 +0200
+++ b/PopUpList.st	Tue Apr 13 13:20:34 1999 +0200
@@ -477,7 +477,7 @@
     "set (force) a selection - usually done to set
      an initial selection without updating others"
 
-    |index menuLabels|
+    |index menuLabels newLabel|
 
     menu isNil ifTrue:[
         self getListFromModel.
@@ -501,12 +501,13 @@
     ].
 
     index == 0 ifTrue:[
-        self label:defaultLabel suppressResize:true.
-        ^ self
+        newLabel := defaultLabel
+    ] ifFalse:[
+        newLabel := (menuLabels at:index) printString
     ].
 
     "kludge: dont want label to resize ..."
-    self label:(menuLabels at:index) printString suppressResize:true.
+    self label:newLabel suppressResize:true.
 
     "
      |p|
@@ -916,7 +917,7 @@
 getSelectionFromModel
     "if I have a model and an aspectMsg, get my current value from it"
 
-    |aspect val|
+    |aspect val newLabel|
 
     (model notNil and:[aspectMsg notNil]) ifTrue:[
         "/ kludge - try #value if aspect is the default and
@@ -933,7 +934,12 @@
         val := (model perform:aspect).
 
         useIndex ifFalse:[
-            ^ self label:val printString suppressResize:true.
+            val isNil ifTrue:[
+                newLabel := defaultLabel 
+            ] ifFalse:[
+                newLabel := val printString.
+            ].
+            ^ self label:newLabel suppressResize:true.
         ].
         self selection:val
     ].
@@ -1038,5 +1044,5 @@
 !PopUpList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.59 1999-03-07 13:40:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.60 1999-04-13 11:20:34 cg Exp $'
 ! !