Microsoft KB Archive/105146

{| = PRB: "DO Nesting Too Deep" with ON KEY LABEL Command from 2.0 =
 * width="100%"|

ID: Q105146

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS
An ON KEY LABEL command that works in FoxPro 2.0 generates a "DO nesting too deep" error message in FoxPro 2.5 for MS-DOS and Windows.

CAUSE
In FoxPro 2.0, you can use a recursive ON KEY LABEL command such as ON KEY LABEL SPACEBAR KEYBOARD '{SHIFT+SPACEBAR}.' However, if you use a recursive ON KEY LABEL command in FoxPro 2.5 for MS-DOS and Windows, you will receive the above-mentioned error. This is correct behavior because you are using a key that is used to call the ON KEY LABEL command.

RESOLUTION
To correct this problem, append the PLAIN clause to the end of the ON KEY LABEL command, as shown at the end of the "More Information" section below.

MORE INFORMATION
The following code illustrates the problem. This code can be run from a .PRG file.

* Beginning of code

ON KEY LABEL SPACEBAR KEYBOARD '{SHIFT+SPACEBAR}' CLEAR DEFINE POPUP fruits FROM 5,5 MULTISELECT MARGIN DEFINE BAR 1 OF fruits PROMPT '\<Apples' MARK CHR(3) DEFINE BAR 2 OF fruits PROMPT '\<Bananas' MARK CHR(4) DEFINE BAR 3 OF fruits PROMPT '\<Grapes' MARK CHR(5) DEFINE BAR 4 OF fruits PROMPT '\<Lemons' MARK CHR(6)

ACTIVATE POPUP fruits

* End of code When the SPACEBAR is pressed in FoxPro 2.0, FoxPro will mark the bar as selected. In FoxPro 2.5 for MS-DOS and Windows, FoxPro will give you the above-mentioned error message. To correct this situation in FoxPro 2.5, issue the following ON KEY LABEL command instead: ON KEY LABEL SPACEBAR KEYBOARD '{SHIFT+SPACEBAR}' PLAIN Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a errmsg err msg KBCategory: kbprg kberrmsg kbprb KBSubcategory: FxprgGeneral
 * }