--- a/SelList.st Sat Apr 20 15:54:48 1996 +0200
+++ b/SelList.st Sat Apr 20 15:55:13 1996 +0200
@@ -120,12 +120,12 @@
^ AspectAdaptor
subject:self
- sendsUpdates:true
+ sendsUpdates:false
accessWith:#selection
assignWith:#'selection:'
aspect:#selectionIndex
- "Modified: 18.4.1996 / 01:44:15 / cg"
+ "Modified: 20.4.1996 / 12:59:23 / cg"
!
selectionIndexHolder
@@ -188,27 +188,33 @@
"whenever one of my holders value changes,
tell my dependents about this"
+ |oldSelection|
+
changedObject == selectionIndexHolder ifTrue:[
-"/ self notifyChange:#selectionIndex
self changed:#selectionIndex
] ifFalse:[
changedObject == listHolder ifTrue:[
something == #value ifTrue:[
- self clearSelection.
-"/ self notifyChange:#list.
-"/ selectionIndexHolder notifyChange:#value
+ oldSelection := selectionIndexHolder value.
+ self clearSelection. "/ clears without update
self changed:#list.
- selectionIndexHolder changed:#value
+ oldSelection ~= (selectionIndexHolder value) ifTrue:[
+ selectionIndexHolder changed:#value
+ ]
]
]
]
+
+ "Modified: 20.4.1996 / 13:08:32 / cg"
! !
!SelectionInList methodsFor:'initialization'!
initialize
self listHolder:(nil asValue). "/ could also use an empty collection here
- self selectionIndexHolder:(nil asValue).
+ self selectionIndexHolder:(self zeroIndex asValue).
+
+ "Modified: 20.4.1996 / 13:11:02 / cg"
! !
!SelectionInList methodsFor:'obsolete backward compatibility'!
@@ -244,11 +250,25 @@
!SelectionInList methodsFor:'private'!
clearSelection
- selectionIndexHolder setValue:0.
+ selectionIndexHolder setValue:self zeroIndex.
+
+ "Modified: 20.4.1996 / 13:11:34 / cg"
+! !
+
+!SelectionInList methodsFor:'queries'!
+
+zeroIndex
+ "return the selections index returned when nothing
+ is selected. Although I would prefer nil,
+ ST-80 uses 0 to represent `no-selection'. (sigh)"
+
+ ^ 0
+
+ "Created: 20.4.1996 / 13:10:53 / cg"
! !
!SelectionInList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelList.st,v 1.10 1996-04-17 23:56:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelList.st,v 1.11 1996-04-20 13:55:13 cg Exp $'
! !
--- a/SelectionInList.st Sat Apr 20 15:54:48 1996 +0200
+++ b/SelectionInList.st Sat Apr 20 15:55:13 1996 +0200
@@ -120,12 +120,12 @@
^ AspectAdaptor
subject:self
- sendsUpdates:true
+ sendsUpdates:false
accessWith:#selection
assignWith:#'selection:'
aspect:#selectionIndex
- "Modified: 18.4.1996 / 01:44:15 / cg"
+ "Modified: 20.4.1996 / 12:59:23 / cg"
!
selectionIndexHolder
@@ -188,27 +188,33 @@
"whenever one of my holders value changes,
tell my dependents about this"
+ |oldSelection|
+
changedObject == selectionIndexHolder ifTrue:[
-"/ self notifyChange:#selectionIndex
self changed:#selectionIndex
] ifFalse:[
changedObject == listHolder ifTrue:[
something == #value ifTrue:[
- self clearSelection.
-"/ self notifyChange:#list.
-"/ selectionIndexHolder notifyChange:#value
+ oldSelection := selectionIndexHolder value.
+ self clearSelection. "/ clears without update
self changed:#list.
- selectionIndexHolder changed:#value
+ oldSelection ~= (selectionIndexHolder value) ifTrue:[
+ selectionIndexHolder changed:#value
+ ]
]
]
]
+
+ "Modified: 20.4.1996 / 13:08:32 / cg"
! !
!SelectionInList methodsFor:'initialization'!
initialize
self listHolder:(nil asValue). "/ could also use an empty collection here
- self selectionIndexHolder:(nil asValue).
+ self selectionIndexHolder:(self zeroIndex asValue).
+
+ "Modified: 20.4.1996 / 13:11:02 / cg"
! !
!SelectionInList methodsFor:'obsolete backward compatibility'!
@@ -244,11 +250,25 @@
!SelectionInList methodsFor:'private'!
clearSelection
- selectionIndexHolder setValue:0.
+ selectionIndexHolder setValue:self zeroIndex.
+
+ "Modified: 20.4.1996 / 13:11:34 / cg"
+! !
+
+!SelectionInList methodsFor:'queries'!
+
+zeroIndex
+ "return the selections index returned when nothing
+ is selected. Although I would prefer nil,
+ ST-80 uses 0 to represent `no-selection'. (sigh)"
+
+ ^ 0
+
+ "Created: 20.4.1996 / 13:10:53 / cg"
! !
!SelectionInList class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/SelectionInList.st,v 1.10 1996-04-17 23:56:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/SelectionInList.st,v 1.11 1996-04-20 13:55:13 cg Exp $'
! !