ON KEY LABEL in FoxPro for MS-DOS Active in System Menu

Last reviewed: April 18, 1995
Article ID: Q119897
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.5x, 2.6, 2.6a

SUMMARY

The online Help system and page L3-708 in the "Language Reference" manual state that:

   "ON KEY LABEL" key assignments aren't in effect in the FoxPro
   system menu bar, dialogs, alerts, system popups and so on.

This statement is true in FoxPro for Windows and FoxPro for Macintosh. However, ON KEY LABEL assignments ARE in effect in FoxPro for MS-DOS during these situations.

MORE INFORMATION

When a system menu popup is in the open state in FoxPro for Windows or Macintosh, FoxPro does not trap for the ON KEY LABEL event because any pending events will go through the Windows or Macintosh event handler. In MS-DOS, FoxPro's event handler handles all events (including ON KEY LABEL events) when the popup is in the open state. This is considered correct behavior because of the environment in which the program is working.

Steps to Reproduce Behavior

  1. Start FoxPro for MS-DOS.

  2. In the Command window, type

          ON KEY LABEL F5 DIR
    

  3. Click a menu pad and then press F5. The ON KEY LABEL event will activate. If the same test is performed on the Windows or Macintosh platforms, the ON KEY LABEL statement is ignored.

Workaround for MS-DOS System Menu

  1. In the Command window, type:

          ON KEY LABEL DNARROW DO mycode.prg
    

  2. Create a .PRG file called MYCODE. Add the following code to the file, with any code changes appropriate to your situation:

          IF PAD()==""
    
             WAIT WINDOW "Code Needed When Down Arrow Used"
             * This is where user-specific code should go.
          ELSE
             KEYBOARD '{DNARROW}' PLAIN
             * This line is to make sure the down arrow behaves
             * as desired in a system menu.
          ENDIF
    


Additional reference words: FoxDos 2.50 2.50a 2.50b 2.60 2.60a docerr
KBCategory: kbprg kbdocerr
KBSubcategory:


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: April 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.