FlyByHelp.st
changeset 2679 552847065fb3
parent 2651 7275384a60c7
child 2680 466b7114fd33
--- a/FlyByHelp.st	Wed May 13 18:40:37 2009 +0200
+++ b/FlyByHelp.st	Thu May 14 14:19:01 2009 +0200
@@ -12,7 +12,8 @@
 "{ Package: 'stx:libview2' }"
 
 ActiveHelp subclass:#FlyByHelp
-	instanceVariableNames:'currentFrame currentView currentHelpView showProcess closeProcess'
+	instanceVariableNames:'currentFrame currentView currentHelpView showProcess closeProcess
+		lastTime'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Help'
@@ -167,13 +168,28 @@
      re-negotiation of the displayed helpText 
      (for example in a menu, when the selection changes)"
 
-    |text delayTime|
+    |text delayTime now|
 
     (self interestedIn:aView) ifFalse:[
         ^ self
     ].
 
-    text := self helpTextFor:aView at:aPointOrNil.
+    "/ avoid spending too much time in the flyByHelp processing code
+    "/ for one, do not perform it more often than once every 200 ms
+    now := Timestamp now.
+    lastTime notNil ifTrue:[
+        (now millisecondDeltaFrom: lastTime) < 200 ifTrue:[
+            ^ self
+        ].
+    ].
+    lastTime := now.
+
+    "/ and also do not allow for more than 200 ms to be spent in the
+    "/ helpText gatherer (the codeView parses the code for the variable under the cursor)
+    [
+        text := self helpTextFor:aView at:aPointOrNil.
+    ] valueWithWatchDog:[^ self ] afterMilliseconds:200.
+
     lastHelpText = text ifTrue:[
         self toolTipFollowsMouse ifFalse:[
             ^ self
@@ -333,7 +349,7 @@
 !FlyByHelp class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.27 2009-05-06 13:21:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.28 2009-05-14 12:19:01 cg Exp $'
 ! !
 
 FlyByHelp initialize!