PRB: "DO Nesting Too Deep" with ON KEY LABEL Command from 2.0

Last reviewed: June 27, 1995
Article 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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.