more selection:/setSelection: stuff
authorClaus Gittinger <cg@exept.de>
Sat, 25 May 1996 16:35:41 +0200
changeset 686 03328d8ef2b6
parent 685 48b91a79927d
child 687 35d407badade
more selection:/setSelection: stuff
SelListV.st
SelectionInListView.st
--- a/SelListV.st	Sat May 25 14:24:27 1996 +0200
+++ b/SelListV.st	Sat May 25 16:35:41 1996 +0200
@@ -1227,21 +1227,23 @@
      we have to remove the highlight frame by hand here"
 
     (shown and:[hilightLevel ~~ 0]) ifTrue:[
-	selection == firstLineShown ifTrue:[
-	   self paint:bgColor.
-	   self fillRectangleX:margin y:margin
-			  width:(width - (margin * 2)) 
-			 height:(hilightLevel abs).
-	].
+        selection == firstLineShown ifTrue:[
+           self paint:bgColor.
+           self fillRectangleX:margin y:margin
+                          width:(width - (margin * 2)) 
+                         height:(hilightLevel abs).
+        ].
     ].
 
     aBoolean ifTrue:[
-	oldSelection := selection.
-	selection := nil.
+        oldSelection := selection.
+        selection := nil.
     ].
     listAttributes := nil.
     super list:aCollection expandTabs:printItems.
-    self selection:oldSelection. "/ nil if keep is false
+    self setSelection:oldSelection. "/ nil if keep is false
+
+    "Modified: 25.5.1996 / 16:31:13 / cg"
 !
 
 printItems:aBoolean
@@ -2173,15 +2175,17 @@
     |sel|
 
     model notNil ifTrue:[
-	initialSelectionMsg notNil ifTrue:[
-	    sel := model perform:initialSelectionMsg.
-	    useIndex ifTrue:[
-		self selection:sel 
-	    ] ifFalse:[
-		self selectElement:sel.
-	    ].
-	]
+        initialSelectionMsg notNil ifTrue:[
+            sel := model perform:initialSelectionMsg.
+            useIndex ifTrue:[
+                self setSelection:sel 
+            ] ifFalse:[
+                self setSelectElement:sel.
+            ].
+        ]
     ].
+
+    "Modified: 25.5.1996 / 16:34:54 / cg"
 !
 
 isValidSelection:aNumberOrCollection
@@ -2779,6 +2783,26 @@
     ^ self at:selection
 !
 
+setSelectElement:anObject
+    "select the element with same printString as the argument, anObject.
+     Scroll to make the new selection visible.
+     No model and/or actionBlock notification is done."
+
+    |lineNo|
+
+    list notNil ifTrue:[
+        items notNil ifTrue:[
+            lineNo := items indexOf:anObject ifAbsent:nil
+        ] ifFalse:[
+            lineNo := list indexOf:(anObject printString) ifAbsent:nil.
+        ].
+        lineNo notNil ifTrue:[self setSelection:lineNo]
+    ]
+
+    "Modified: 25.5.1996 / 13:05:03 / cg"
+    "Created: 25.5.1996 / 16:34:35 / cg"
+!
+
 setSelection:aNumberOrNil
     "select line, aNumber or deselect if argument is nil;
      scroll to make the selected line visible.
@@ -2817,5 +2841,5 @@
 !SelectionInListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.72 1996-05-25 11:23:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.73 1996-05-25 14:35:41 cg Exp $'
 ! !
--- a/SelectionInListView.st	Sat May 25 14:24:27 1996 +0200
+++ b/SelectionInListView.st	Sat May 25 16:35:41 1996 +0200
@@ -1227,21 +1227,23 @@
      we have to remove the highlight frame by hand here"
 
     (shown and:[hilightLevel ~~ 0]) ifTrue:[
-	selection == firstLineShown ifTrue:[
-	   self paint:bgColor.
-	   self fillRectangleX:margin y:margin
-			  width:(width - (margin * 2)) 
-			 height:(hilightLevel abs).
-	].
+        selection == firstLineShown ifTrue:[
+           self paint:bgColor.
+           self fillRectangleX:margin y:margin
+                          width:(width - (margin * 2)) 
+                         height:(hilightLevel abs).
+        ].
     ].
 
     aBoolean ifTrue:[
-	oldSelection := selection.
-	selection := nil.
+        oldSelection := selection.
+        selection := nil.
     ].
     listAttributes := nil.
     super list:aCollection expandTabs:printItems.
-    self selection:oldSelection. "/ nil if keep is false
+    self setSelection:oldSelection. "/ nil if keep is false
+
+    "Modified: 25.5.1996 / 16:31:13 / cg"
 !
 
 printItems:aBoolean
@@ -2173,15 +2175,17 @@
     |sel|
 
     model notNil ifTrue:[
-	initialSelectionMsg notNil ifTrue:[
-	    sel := model perform:initialSelectionMsg.
-	    useIndex ifTrue:[
-		self selection:sel 
-	    ] ifFalse:[
-		self selectElement:sel.
-	    ].
-	]
+        initialSelectionMsg notNil ifTrue:[
+            sel := model perform:initialSelectionMsg.
+            useIndex ifTrue:[
+                self setSelection:sel 
+            ] ifFalse:[
+                self setSelectElement:sel.
+            ].
+        ]
     ].
+
+    "Modified: 25.5.1996 / 16:34:54 / cg"
 !
 
 isValidSelection:aNumberOrCollection
@@ -2779,6 +2783,26 @@
     ^ self at:selection
 !
 
+setSelectElement:anObject
+    "select the element with same printString as the argument, anObject.
+     Scroll to make the new selection visible.
+     No model and/or actionBlock notification is done."
+
+    |lineNo|
+
+    list notNil ifTrue:[
+        items notNil ifTrue:[
+            lineNo := items indexOf:anObject ifAbsent:nil
+        ] ifFalse:[
+            lineNo := list indexOf:(anObject printString) ifAbsent:nil.
+        ].
+        lineNo notNil ifTrue:[self setSelection:lineNo]
+    ]
+
+    "Modified: 25.5.1996 / 13:05:03 / cg"
+    "Created: 25.5.1996 / 16:34:35 / cg"
+!
+
 setSelection:aNumberOrNil
     "select line, aNumber or deselect if argument is nil;
      scroll to make the selected line visible.
@@ -2817,5 +2841,5 @@
 !SelectionInListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.72 1996-05-25 11:23:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.73 1996-05-25 14:35:41 cg Exp $'
 ! !