DSVColumnView.st
changeset 4459 0fd01d06e0b4
parent 4425 c013e9757f1a
child 4486 3407ac48b630
--- a/DSVColumnView.st	Fri Dec 06 14:20:10 2013 +0100
+++ b/DSVColumnView.st	Fri Dec 06 19:19:27 2013 +0100
@@ -4406,7 +4406,7 @@
 !
 
 selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor
-    |view p|
+    |view p shouldClick editorType|
 
     view := editView.
     self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor.
@@ -4421,9 +4421,22 @@
     ].
     view := self detectViewAt:aPoint ignoreInvisible:true.
 
-    PreselectAllWhenOpeningEditor == true ifFalse:[
+    shouldClick := true.
+    "/ when PreselectAllWhenOpeningEditor is true, we should not click into
+    "/ the editor, as this couldclear the selection.
+    "/ however, for non-text editors, it is a good idea to do so...
+    PreselectAllWhenOpeningEditor == true ifTrue:[
+        shouldClick := false.
+
+        editorType := self selectedColumn editorType.
+        editorType == #ComboList ifTrue:[ shouldClick := true ].
+        "/ TODO: more heuristics here...
+        "/ editorType == #RadioButton ifTrue:[ ].
+    ].
+
+    shouldClick ifTrue:[
         "/ simulate clicking into the editor
-self breakPoint:#ca.
+        self breakPoint:#ca.
         (view ~~ self and:[view notNil]) ifTrue:[ 
             p := device translatePoint:aPoint fromView:self toView:view.
             self sensor 
@@ -4764,10 +4777,10 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.289 2013-09-27 08:10:46 ab Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.290 2013-12-06 18:19:27 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.289 2013-09-27 08:10:46 ab Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.290 2013-12-06 18:19:27 cg Exp $'
 ! !