bug fix if operation cancled by #Escape, must invoke #leave
authorca
Fri, 04 Oct 2002 07:26:48 +0200
changeset 1629 9b0f45e63e24
parent 1628 00275352f251
child 1630 6ba485332ce5
bug fix if operation cancled by #Escape, must invoke #leave
DragAndDropManager.st
--- a/DragAndDropManager.st	Wed Oct 02 11:35:53 2002 +0200
+++ b/DragAndDropManager.st	Fri Oct 04 07:26:48 2002 +0200
@@ -1263,18 +1263,30 @@
 !
 
 keyPress:aKey x:x y:y view:aView
-    escapePressed == true ifTrue:[^ self ].
+    "any key is pressed:
+        #Escape         cancel drag & drop operation
+    "
+    |dropTarget|
 
-    escapePressed := aKey == #Escape.
+    escapePressed == true ifTrue:[^ self ].     "/ already canceled
+
+    aKey == #Escape ifTrue:[
+        "/ cancel drag & drop operation
+        escapePressed := true.
 
-    escapePressed ifFalse:[
-        ^ self
+        handler ifNotNil:[
+            "/ restore handler
+            dropTarget := dropContext dropTarget.
+            handler postDragging.
+
+            dropTarget ifNotNil:[
+                "/ invoke leave operation
+                dropTarget leave:dropContext.
+                dropContext dropTarget:nil.
+            ].
+        ].
+        ^ self  
     ].
-    handler ifNotNil:[
-        handler postDragging
-    ].
-"/    self buttonMotion:#select x:x y:y view:aView.
-"/    restoreBlock value.
 ! !
 
 !DragAndDropManager methodsFor:'initialization'!
@@ -1446,6 +1458,7 @@
 !DragAndDropManager class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.41 2002-09-16 10:17:07 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.42 2002-10-04 05:26:48 ca Exp $'
 ! !
+
 DragAndDropManager initialize!