ST-80 compatibility changes.
Handle the case, where the listHolder holds a menu
and the model the selected value.
kludgy
--- a/PopUpList.st Fri Jun 19 01:03:00 1998 +0200
+++ b/PopUpList.st Fri Jun 19 01:05:00 1998 +0200
@@ -661,14 +661,20 @@
aspectMsg notNil ifTrue:[
self getSelectionFromModel.
].
- listMsg notNil ifTrue:[
- self getListFromModel.
+ listHolder notNil ifTrue:[
+ "/ that one holds the list;
+ "/ model holds the value
+ self getSelectionFromModel
+ ] ifFalse:[
+ listMsg notNil ifTrue:[
+ self getListFromModel.
+ ]
].
^ self
].
super update:something with:aParameter from:changedObject
- "Modified: 28.2.1997 / 15:18:58 / cg"
+ "Modified: / 18.6.1998 / 23:48:47 / cg"
! !
!PopUpList methodsFor:'drawing'!
@@ -716,7 +722,7 @@
!
popMenu
- |org mv w theMenu|
+ |org mv w theMenu val|
menu notNil ifTrue:[
theMenu := menu value
@@ -753,9 +759,15 @@
theMenu showAt:org "resizing:false"
] ifFalse:[
"/ newStyle - theMenu is a Menu
- theMenu startUp
+ val := theMenu startUp.
+ (theMenu isKindOf:PopUpMenu) ifFalse:[
+ "/ sigh - brand new ...
+ self sendChangeMessage:changeMsg with:val.
+ ].
]
].
+
+ "Modified: / 18.6.1998 / 23:47:39 / cg"
! !
!PopUpList methodsFor:'initialization'!
@@ -826,12 +838,19 @@
!
createMenuFor:aList
+ (aList isKindOf:Menu) ifTrue:[
+ menu := aList.
+ ^ self.
+ ].
+
menu := PopUpMenu
- labels:aList
- selectors:#select:
- args:(1 to:aList size)
- receiver:self
- for:self.
+ labels:aList
+ selectors:#select:
+ args:(1 to:aList size)
+ receiver:self
+ for:self.
+
+ "Modified: / 18.6.1998 / 23:20:16 / cg"
!
getListFromModel
@@ -839,7 +858,10 @@
otherwise, if I have a model and a listMsg, get my list from there"
listHolder notNil ifTrue:[
- self list:listHolder value
+ self list:listHolder value.
+ model notNil ifTrue:[
+ self halt.
+ ]
] ifFalse:[
(listMsg notNil and:[model notNil]) ifTrue:[
(model respondsTo:listMsg) ifTrue:[
@@ -848,13 +870,13 @@
].
]
- "Modified: 27.2.1997 / 14:05:52 / cg"
+ "Modified: / 18.6.1998 / 23:47:30 / cg"
!
getSelectionFromModel
"if I have a model and an aspectMsg, get my current value from it"
- |aspect|
+ |aspect val|
(model notNil and:[aspectMsg notNil]) ifTrue:[
"/ kludge - try #value if aspect is the default and
@@ -868,10 +890,15 @@
aspect := #value
]
].
- self selection:(model perform:aspect)
+ val := (model perform:aspect).
+
+ useIndex ifFalse:[
+ ^ self label:val printString suppressResize:true.
+ ].
+ self selection:val
].
- "Modified: 28.2.1997 / 13:40:46 / cg"
+ "Modified: / 18.6.1998 / 23:54:34 / cg"
! !
!PopUpList methodsFor:'private-controller access'!
@@ -971,5 +998,5 @@
!PopUpList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.55 1998-04-21 18:06:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.56 1998-06-18 23:05:00 cg Exp $'
! !