DSVLabelView.st
changeset 3216 18f104700621
parent 3214 28214ee49bb6
child 3324 bdd503be73d1
--- a/DSVLabelView.st	Mon Mar 26 14:44:55 2007 +0200
+++ b/DSVLabelView.st	Mon Mar 26 15:22:19 2007 +0200
@@ -291,7 +291,7 @@
      redraw thumb at its new position and, if scroll-mode is asynchronous, 
      the scroll action is performed
     "
-    |idx x1 col|
+    |colNr x1 col|
 
     state = 0 ifTrue:[
         lineDrag := nil.
@@ -311,42 +311,43 @@
     ].
 
     "/ in the resize area ?
-    idx := self xVisibleToColNr:(x-tabSpacing).
-    col := columns at:idx ifAbsent:nil.
+    colNr := self xVisibleToColNr:(x-tabSpacing).
+    colNr notNil ifTrue:[
+        col := columns at:colNr.
 
-    (col notNil and:[col isResizeable]) ifTrue:[
-        x1 := self xVisibleOfColNr:(idx + 1).
-        (x between:(x1-tabSpacing) and:(x1+tabSpacing))
-        "/ x + tabSpacing > x1 
-        ifTrue:[
-            self cursor:handleCursor.
-            ^ self
+        (col notNil and:[col isResizeable]) ifTrue:[
+            x1 := self xVisibleOfColNr:(colNr + 1).
+            (x between:(x1-tabSpacing) and:(x1+tabSpacing))
+            "/ x + tabSpacing > x1 
+            ifTrue:[
+                self cursor:handleCursor.
+                ^ self
+            ].
         ].
     ].
-
     self cursor:(Cursor normal)
 
-    "Modified: / 26-03-2007 / 13:36:01 / cg"
+    "Modified: / 26-03-2007 / 15:20:27 / cg"
 !
 
 buttonPress:button x:x y:y
     "handle a button press event; checks whether the item under the mouse
      is selectable. If true, the selection is set to the item.
     "
-    |x1 idx col|
+    |x1 colNr col|
 
     (enabled and:[shown]) ifFalse:[
         ^ self
     ].
 
     "/ in the resize area ?
-    idx := self xVisibleToColNr:(x-tabSpacing).
-    idx ~~ 0 ifTrue:[
-        col := columns at:idx.
+    colNr := self xVisibleToColNr:(x-tabSpacing).
+    colNr notNil ifTrue:[
+        col := columns at:colNr.
         col isResizeable ifTrue:[
-            x1 := self xVisibleOfColNr:(idx + 1).
+            x1 := self xVisibleOfColNr:(colNr + 1).
             (x between:(x1-tabSpacing) and:(x1+tabSpacing)) ifTrue:[
-                col := columns at:idx ifAbsent:nil.
+                col := columns at:colNr ifAbsent:nil.
                 self cursor:handleCursor.
 
                 lineDrag := LineDrag new.
@@ -364,16 +365,16 @@
         ]
     ].
 
-    idx := self xVisibleToColNr:x.
-    idx ~~ 0 ifTrue:[
-        col := columns at:idx.
+    colNr := self xVisibleToColNr:x.
+    colNr notNil ifTrue:[
+        col := columns at:colNr.
         col label isSelectable ifTrue:[
-            self invalidateItemAt:(selection := idx)
+            self invalidateItemAt:(selection := colNr)
         ].
     ].
     self cursor:(Cursor normal).
 
-    "Modified: / 26-03-2007 / 13:35:07 / cg"
+    "Modified: / 26-03-2007 / 15:21:00 / cg"
 !
 
 buttonRelease:button x:x y:y
@@ -438,9 +439,9 @@
             ^ index
         ]
     ].
-    ^ 0
+    ^ nil
 
-    "Modified: / 26-03-2007 / 13:32:00 / cg"
+    "Modified: / 26-03-2007 / 15:21:37 / cg"
 ! !
 
 !DSVLabelView methodsFor:'focus handling'!
@@ -464,13 +465,14 @@
 
     columns isEmpty ifTrue:[^ nil].
     colNr := self xVisibleToColNr:aPoint x.
-    colNr ~~ 0 ifTrue:[
+    colNr notNil ifTrue:[
         col := columns at:colNr.
         ^ col activeHelpText.
     ].
     ^ nil
 
     "Created: / 26-03-2007 / 13:43:20 / cg"
+    "Modified: / 26-03-2007 / 15:21:07 / cg"
 ! !
 
 !DSVLabelView methodsFor:'initialization'!
@@ -553,17 +555,20 @@
     "returns the column number assigned to a physical x or nil. If
      the column exists but is not selectable nil is returned.
     "
-    |index column|
+
+    |colNr column|
 
     (shown and:[enabled]) ifTrue:[
-        (     (index  := dataSet xVisibleToColNr:x)  notNil
-         and:[(column := columns at:index ifAbsent:nil) notNil
+        ((colNr  := dataSet xVisibleToColNr:x)  notNil
+         and:[(column := columns at:colNr) notNil
          and:[column label isSelectable]]
         ) ifTrue:[
-            ^ index
+            ^ colNr
         ]
     ].
     ^ nil
+
+    "Modified: / 26-03-2007 / 15:21:27 / cg"
 ! !
 
 !DSVLabelView methodsFor:'scrolling'!
@@ -644,5 +649,5 @@
 !DSVLabelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.53 2007-03-26 12:43:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.54 2007-03-26 13:22:19 cg Exp $'
 ! !