#BUGFIX by cg
class: ComboListView
comment/format in: #useIndex:
changed: #contents
ix: ensure the contents is one of the values,
if there is a value list.
--- a/ComboListView.st Tue Mar 07 17:43:19 2017 +0100
+++ b/ComboListView.st Wed Mar 08 01:25:43 2017 +0100
@@ -456,7 +456,7 @@
!
useIndex:aBoolean
- "specify, if the selected components value or its index in the
+ "specify, if the selected component's value or its index in the
list should be sent to the model. The default is its value."
useIndex := aBoolean.
@@ -475,8 +475,9 @@
"/ ]
"/ ].
- "Created: 26.7.1996 / 17:44:18 / cg"
- "Modified: / 24.1.1998 / 19:06:41 / cg"
+ "Created: / 26-07-1996 / 17:44:18 / cg"
+ "Modified: / 24-01-1998 / 19:06:41 / cg"
+ "Modified (comment): / 08-03-2017 / 01:12:50 / cg"
!
values:aCollection
@@ -505,13 +506,22 @@
"get the current value - either in the fields model
or directly"
- |m|
+ |m val idx|
(m := field model) notNil ifTrue:[
- ^ m value
+ val := m value
] ifFalse:[
- ^ field label
- ]
+ val := field label
+ ].
+ "/ make sure we return the value - not the string!!
+ values notNil ifTrue:[
+ idx := list indexOf:val.
+ idx == 0 ifTrue:[^ nil].
+ val := values at:idx ifAbsent:[nil].
+ ].
+ ^ val.
+
+ "Modified: / 08-03-2017 / 01:23:18 / cg"
!
contents:something