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

ID: Q119897

The information in this article applies to:

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:

Last Reviewed: April 18, 1995