allow index-passing (#useIndex:)
and fetch initial value from model.
--- a/ComboListV.st Fri Jul 26 18:03:25 1996 +0200
+++ b/ComboListV.st Fri Jul 26 18:04:34 1996 +0200
@@ -1,5 +1,5 @@
ComboView subclass:#ComboListView
- instanceVariableNames:''
+ instanceVariableNames:'useIndex'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
@@ -86,6 +86,17 @@
"
! !
+!ComboListView methodsFor:'accessing-behavior'!
+
+useIndex:aBoolean
+ "specify, if the selected components value or its index in the
+ list should be sent to the model. The default is its value."
+
+ useIndex := aBoolean.
+
+ "Created: 26.7.1996 / 17:44:18 / cg"
+! !
+
!ComboListView methodsFor:'accessing-components'!
label
@@ -114,6 +125,13 @@
!ComboListView methodsFor:'initialization'!
+initialize
+ useIndex isNil ifTrue:[useIndex := false].
+ super initialize.
+
+ "Created: 26.7.1996 / 17:44:57 / cg"
+!
+
initializeField
field := Label in:self.
field level:-1.
@@ -137,25 +155,37 @@
model notNil ifTrue:[
(model respondsTo:#selection) ifTrue:[
self contents:(model selection)
+ ] ifFalse:[
+ self contents:model value
]
].
"Created: 15.7.1996 / 12:28:53 / cg"
+ "Modified: 26.7.1996 / 17:59:15 / cg"
! !
!ComboListView methodsFor:'user interaction'!
-entryChanged:what
+entryChanged:index
+ |what|
+
+ what := list at:index.
field label:what.
- model notNil ifTrue:[model value:what].
+ model notNil ifTrue:[
+ useIndex ifTrue:[
+ model value:index
+ ] ifFalse:[
+ model value:what
+ ]
+ ].
pullDownButton turnOff.
"Created: 28.2.1996 / 15:13:46 / cg"
- "Modified: 28.2.1996 / 15:19:00 / cg"
+ "Modified: 26.7.1996 / 17:46:04 / cg"
! !
!ComboListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboListV.st,v 1.4 1996-07-15 14:40:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboListV.st,v 1.5 1996-07-26 16:04:34 cg Exp $'
! !
--- a/ComboListView.st Fri Jul 26 18:03:25 1996 +0200
+++ b/ComboListView.st Fri Jul 26 18:04:34 1996 +0200
@@ -1,5 +1,5 @@
ComboView subclass:#ComboListView
- instanceVariableNames:''
+ instanceVariableNames:'useIndex'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
@@ -86,6 +86,17 @@
"
! !
+!ComboListView methodsFor:'accessing-behavior'!
+
+useIndex:aBoolean
+ "specify, if the selected components value or its index in the
+ list should be sent to the model. The default is its value."
+
+ useIndex := aBoolean.
+
+ "Created: 26.7.1996 / 17:44:18 / cg"
+! !
+
!ComboListView methodsFor:'accessing-components'!
label
@@ -114,6 +125,13 @@
!ComboListView methodsFor:'initialization'!
+initialize
+ useIndex isNil ifTrue:[useIndex := false].
+ super initialize.
+
+ "Created: 26.7.1996 / 17:44:57 / cg"
+!
+
initializeField
field := Label in:self.
field level:-1.
@@ -137,25 +155,37 @@
model notNil ifTrue:[
(model respondsTo:#selection) ifTrue:[
self contents:(model selection)
+ ] ifFalse:[
+ self contents:model value
]
].
"Created: 15.7.1996 / 12:28:53 / cg"
+ "Modified: 26.7.1996 / 17:59:15 / cg"
! !
!ComboListView methodsFor:'user interaction'!
-entryChanged:what
+entryChanged:index
+ |what|
+
+ what := list at:index.
field label:what.
- model notNil ifTrue:[model value:what].
+ model notNil ifTrue:[
+ useIndex ifTrue:[
+ model value:index
+ ] ifFalse:[
+ model value:what
+ ]
+ ].
pullDownButton turnOff.
"Created: 28.2.1996 / 15:13:46 / cg"
- "Modified: 28.2.1996 / 15:19:00 / cg"
+ "Modified: 26.7.1996 / 17:46:04 / cg"
! !
!ComboListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ComboListView.st,v 1.4 1996-07-15 14:40:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ComboListView.st,v 1.5 1996-07-26 16:04:34 cg Exp $'
! !