EditTextViewCompletionSupport.st
changeset 5772 fa9c46bd7a1b
parent 5705 1de82431490c
child 5788 3043bff6248c
--- a/EditTextViewCompletionSupport.st	Fri Jun 10 04:06:02 2016 +0000
+++ b/EditTextViewCompletionSupport.st	Thu Jun 30 11:15:38 2016 +0200
@@ -3,7 +3,8 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#EditTextViewCompletionSupport
-	instanceVariableNames:'completionView completionProcess editView autoSelect'
+	instanceVariableNames:'completionView completionProcess editView autoSelect
+		editViewLostFocusBlock'
 	classVariableNames:'LastCompletions'
 	poolDictionaries:''
 	category:'Views-Text'
@@ -58,13 +59,14 @@
 !
 
 editViewLostFocus
+    "this is a hack for Windows:
+     on windows, an activate:false event is first sent to my textView,
+     then an activate is sent to the completion popup.
+     this is done BEFORE the buttonPress event is delivered.
+     therefore, allow for the activate of the completionMenu and it's button event to be processed.
+     before forcing it to be closed..."
+
     completionView notNil ifTrue:[
-        "/ this is a hack for Windows:
-        "/ on windows, an activate:false event is first sent to my textView,
-        "/ then an activate is sent to the completion popup.
-        "/ this is done BEFORE the buttonPress event is delivered.
-        "/ therefore, allow for the activate of the completionMenu and it's button event to be processed.
-        "/ before forcing it to be closed...
         editView graphicsDevice anyButtonPressed ifTrue:[
             editView sensor pushUserEvent:#editViewLostFocus for:self.
         ] ifFalse:[
@@ -181,6 +183,15 @@
         ].
         ^ self
     ].
+!
+
+startTimeoutForEditViewLostFocus
+    "see comment in #editViewLostFocus"
+
+    editViewLostFocusBlock isNil ifTrue:[
+        editViewLostFocusBlock := [self editViewLostFocus].
+    ].
+    Processor addTimedBlock:editViewLostFocusBlock afterMilliseconds:200.
 ! !
 
 !EditTextViewCompletionSupport methodsFor:'private'!