suports a listHolder and a model which only
keeps the selection.
--- a/SelListV.st Thu Aug 21 23:53:50 1997 +0200
+++ b/SelListV.st Tue Aug 26 17:32:48 1997 +0200
@@ -1090,6 +1090,15 @@
selectConditionBlock := aBlock
!
+useIndex
+ "set/clear the useIndex flag. If set, both actionBlock and change-messages
+ are passed the index(indices) of the selection as argument.
+ If clear, the value(s) (i.e. the selected string) is passed.
+ Default is true."
+
+ ^ useIndex
+!
+
useIndex:aBoolean
"set/clear the useIndex flag. If set, both actionBlock and change-messages
are passed the index(indices) of the selection as argument.
@@ -1373,6 +1382,20 @@
"Modified: 30.4.1996 / 15:10:03 / cg"
"Created: 28.3.1997 / 21:24:37 / cg"
+!
+
+listHolder
+ ^ listChannel
+!
+
+listHolder:aListHolder
+ listChannel notNil ifTrue:[
+ listChannel removeDependent:self
+ ].
+ (listChannel := aListHolder) notNil ifTrue:[
+ listChannel addDependent:self
+ ].
+ self getListFromModel
! !
!SelectionInListView methodsFor:'accessing-contents'!
@@ -1648,6 +1671,11 @@
^ self
].
].
+ changedObject == listChannel ifTrue:[
+ self getListFromModel.
+ ^ self
+ ].
+
^ super update:something with:aParameter from:changedObject
! !
@@ -2418,34 +2446,27 @@
|text msg|
- model notNil ifTrue:[
- msg := listMsg.
- msg isNil ifTrue:[
- msg := aspectMsg
+ listChannel notNil ifTrue:[
+ items := listChannel value
+ ] ifFalse:[
+ (model isNil or:[(msg := listMsg) isNil and:[(msg := aspectMsg) isNil]]) ifTrue:[
+ ^ self
].
-
- msg notNil ifTrue:[
- items := model perform:msg.
- items notNil ifTrue:[
- printItems ifTrue:[
- text := items collect:[:element | element printString]
- ] ifFalse:[
- text := items
- ].
-"/ text notNil ifTrue:[
-"/ text := text asStringCollection.
-"/ ]
- text notNil ifTrue:[
- text isSequenceable ifFalse:[
- text := text asOrderedCollection
- ]
- ].
- ].
- self list:text keepSelection:true. "/ expandTabs:false
+ items := model perform:msg.
+ ].
+ items notNil ifTrue:[
+ printItems ifTrue:[
+ text := items collect:[:element | element printString]
+ ] ifFalse:[
+ text := items
].
+ text notNil ifTrue:[
+ text isSequenceable ifFalse:[
+ text := text asOrderedCollection
+ ]
+ ]
].
-
- "Modified: 18.4.1997 / 21:11:25 / cg"
+ self list:text keepSelection:true. "/ expandTabs:false
!
getSelectionFromModel
@@ -2454,13 +2475,16 @@
|sel|
model notNil ifTrue:[
- initialSelectionMsg notNil ifTrue:[
+ listChannel notNil ifTrue:[
+ sel := model value.
+ ] ifFalse:[
+ initialSelectionMsg isNil ifTrue:[^ self].
sel := model perform:initialSelectionMsg.
- (useIndex or:[sel isNumber]) ifTrue:[
- self setSelection:sel
- ] ifFalse:[
- self setSelectElement:sel.
- ].
+ ].
+ (useIndex or:[sel isNumber]) ifTrue:[
+ self setSelection:sel
+ ] ifFalse:[
+ self setSelectElement:sel.
]
].
@@ -3296,5 +3320,5 @@
!SelectionInListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.113 1997-08-13 09:28:06 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.114 1997-08-26 15:32:48 ca Exp $'
! !
--- a/SelectionInListView.st Thu Aug 21 23:53:50 1997 +0200
+++ b/SelectionInListView.st Tue Aug 26 17:32:48 1997 +0200
@@ -1090,6 +1090,15 @@
selectConditionBlock := aBlock
!
+useIndex
+ "set/clear the useIndex flag. If set, both actionBlock and change-messages
+ are passed the index(indices) of the selection as argument.
+ If clear, the value(s) (i.e. the selected string) is passed.
+ Default is true."
+
+ ^ useIndex
+!
+
useIndex:aBoolean
"set/clear the useIndex flag. If set, both actionBlock and change-messages
are passed the index(indices) of the selection as argument.
@@ -1373,6 +1382,20 @@
"Modified: 30.4.1996 / 15:10:03 / cg"
"Created: 28.3.1997 / 21:24:37 / cg"
+!
+
+listHolder
+ ^ listChannel
+!
+
+listHolder:aListHolder
+ listChannel notNil ifTrue:[
+ listChannel removeDependent:self
+ ].
+ (listChannel := aListHolder) notNil ifTrue:[
+ listChannel addDependent:self
+ ].
+ self getListFromModel
! !
!SelectionInListView methodsFor:'accessing-contents'!
@@ -1648,6 +1671,11 @@
^ self
].
].
+ changedObject == listChannel ifTrue:[
+ self getListFromModel.
+ ^ self
+ ].
+
^ super update:something with:aParameter from:changedObject
! !
@@ -2418,34 +2446,27 @@
|text msg|
- model notNil ifTrue:[
- msg := listMsg.
- msg isNil ifTrue:[
- msg := aspectMsg
+ listChannel notNil ifTrue:[
+ items := listChannel value
+ ] ifFalse:[
+ (model isNil or:[(msg := listMsg) isNil and:[(msg := aspectMsg) isNil]]) ifTrue:[
+ ^ self
].
-
- msg notNil ifTrue:[
- items := model perform:msg.
- items notNil ifTrue:[
- printItems ifTrue:[
- text := items collect:[:element | element printString]
- ] ifFalse:[
- text := items
- ].
-"/ text notNil ifTrue:[
-"/ text := text asStringCollection.
-"/ ]
- text notNil ifTrue:[
- text isSequenceable ifFalse:[
- text := text asOrderedCollection
- ]
- ].
- ].
- self list:text keepSelection:true. "/ expandTabs:false
+ items := model perform:msg.
+ ].
+ items notNil ifTrue:[
+ printItems ifTrue:[
+ text := items collect:[:element | element printString]
+ ] ifFalse:[
+ text := items
].
+ text notNil ifTrue:[
+ text isSequenceable ifFalse:[
+ text := text asOrderedCollection
+ ]
+ ]
].
-
- "Modified: 18.4.1997 / 21:11:25 / cg"
+ self list:text keepSelection:true. "/ expandTabs:false
!
getSelectionFromModel
@@ -2454,13 +2475,16 @@
|sel|
model notNil ifTrue:[
- initialSelectionMsg notNil ifTrue:[
+ listChannel notNil ifTrue:[
+ sel := model value.
+ ] ifFalse:[
+ initialSelectionMsg isNil ifTrue:[^ self].
sel := model perform:initialSelectionMsg.
- (useIndex or:[sel isNumber]) ifTrue:[
- self setSelection:sel
- ] ifFalse:[
- self setSelectElement:sel.
- ].
+ ].
+ (useIndex or:[sel isNumber]) ifTrue:[
+ self setSelection:sel
+ ] ifFalse:[
+ self setSelectElement:sel.
]
].
@@ -3296,5 +3320,5 @@
!SelectionInListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.113 1997-08-13 09:28:06 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.114 1997-08-26 15:32:48 ca Exp $'
! !