--- a/PopUpList.st Fri Feb 28 10:31:09 1997 +0100
+++ b/PopUpList.st Fri Feb 28 13:43:48 1997 +0100
@@ -789,11 +789,24 @@
getSelectionFromModel
"if I have a model and an aspectMsg, get my current value from it"
+ |aspect|
+
(model notNil and:[aspectMsg notNil]) ifTrue:[
- self selection:(model perform:aspectMsg)
+ "/ kludge - try #value if aspect is the default and
+ "/ not understood by the model
+ "/ this allows a valueHolder to be used, even
+ "/ if the aspectMessage was not setup correctly.
+
+ aspect := aspectMsg.
+ aspect == self class defaultAspectMessage ifTrue:[
+ (model respondsTo:aspect) ifFalse:[
+ aspect := #value
+ ]
+ ].
+ self selection:(model perform:aspect)
].
- "Modified: 26.2.1997 / 18:21:59 / cg"
+ "Modified: 28.2.1997 / 13:40:46 / cg"
!
realize
@@ -846,7 +859,7 @@
select:anIndex
"this is sent from the popupmenu when an entry was selected"
- |value label|
+ |value label chg|
values isNil ifTrue:[
value := anIndex.
@@ -866,11 +879,26 @@
self label:label printString.
].
- "/
- "/ ST-80 way of doing it
- "/ tell my model - if any
- "/
- self sendChangeMessageWith:value.
+ (model notNil and:[changeMsg notNil]) ifTrue:[
+ "/
+ "/ ST-80 way of doing it
+ "/ tell my model - if any
+ "/
+
+ "/ kludge - try #value: if changeMsg is the default and
+ "/ not understood by the model
+ "/ this allows a valueHolder to be used, even
+ "/ if the aspectMessage was not setup correctly.
+
+ chg := changeMsg.
+ chg == self class defaultChangeMessage ifTrue:[
+ (model respondsTo:chg) ifFalse:[
+ chg := #value
+ ]
+ ].
+
+ self sendChangeMessage:chg with:value.
+ ].
"/
"/ ST/X action blocks
@@ -879,11 +907,11 @@
menuAction value:value.
].
- "Modified: 27.2.1997 / 15:03:02 / cg"
+ "Modified: 28.2.1997 / 13:43:06 / cg"
! !
!PopUpList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.40 1997-02-27 14:48:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.41 1997-02-28 12:43:48 cg Exp $'
! !