Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loop never stops
Message
 
To
09/12/2004 18:44:31
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00967910
Message ID:
00968332
Views:
11
>Hi Jim
>I tried that one too.
>the moment the execution goes in to loop it just ignores my keyboard input .

You may have to put a pause in the loop to allow VFP to process the keyboard for you occasionally. The problem is that your code is not allowing Fox to see the key press event. I have handled this situation this way in the past;
* Need a loop that can be exited by keystroke
ON KEY LABEL ESCAPE llCancel = .T.
llCancel = .F.
lnCnt = 1
DO WHILE NOT llCancel
   * Lots of code here

   lnCnt = lnCnt + 1
   IF MOD(lnCnt,100) = 0
      DOEVENTS
   ENDIF
ENDDO
The DoEvents will cause Fox to process the even queue and see the key press. DoEvents slows things down though so I only execute it every 100 times through the loop. You can adjust the 100 to whatever gives you the responsiveness to the keywborad you want wihtout slowing the loop too badly.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform