BUG: ON KEY LABEL <Keyname> EXIT Fails with DO WHILE .T. LoopLast reviewed: August 28, 1995Article ID: Q121227 |
The information in this article applies to:
SYMPTOMSIn the following code example, pressing CTRL+C or any other key combination that is defined to terminate the DO WHILE loop will cause a "Nesting error" message. In this example, CTRL+C has been used as a "natural" key combination, although CTRL+D, CTRL+Q, or any other key combination will also produce the same error.
ON KEY LABEL ctrl+C EXIT DO WHILE .T. WAIT WINDOW "hello" NOWAIT ENDDO RESOLUTIONTo set up a DO WHILE control structure that will terminate when a key combination is pressed, create a variable and initialize it to true (.T.). In the ON KEY LABEL statement, reassign the memory variable to false (.F.).
memvar = .T. ON KEY LABEL ctrl+C memvar = .F. DO WHILE memvar WAIT WINDOW "HELLO" NOWAIT ENDDOAnother way of achieving the same result is shown in this second example. In the following code, VAR1 is initialized to null. When the CTRL+C key combination is pressed, VAR1 is assigned the command to be executed. Until VAR1 is assigned something to do, nothing gets done. Upon assignment, the command is executed and the loop is terminated. This indirection also works for other commands as well.
var1="" ON KEY LABEL ctrl+C var1="EXIT" DO WHILE .T. WAIT WINDOW "Hello World" NOWAIT &var1 ENDDO STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional reference words: FoxDos FoxWin buglist2.00 buglist2.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |