How to Set a Default Pad with the Menu Generator

ID: Q110913

2.50b     | 2.00 2.50 2.50a 2.50b | 2.50 2.50a 2.50b
MACINTOSH | MS-DOS                | WINDOWS

The information in this article applies to:

SUMMARY

By following the procedure below, you can use the FoxPro menu generator to set a default pad that will be opened the first time a menu is activated.

MORE INFORMATION

The following steps create a menu that will automatically open a pad named "Reports" when the menu is activated.

1. From the File menu, choose New, select Menu, and then choose OK.

2. From the Menu menu, choose Quick Menu.

3. Add a pad to the menu with the following information:

      Prompt - Rep\<orts
      Result - Submenu

4. Click the Options box, and in the resulting Prompt Options dialog box,
   select the Pad Name check box. In the Pad Name box, type "Reports"
   (without the quotation marks), and then choose OK.

5. Add two bars, A and B, to the Reports pad of the menu.

6. From the Menu menu, choose General Options. In the Procedure dialog box,

   type the following lines of code:

      WAIT WINDOW "You Chose " + PROMPT()

7. In the menu's Cleanup code, enter the following line of code:

      ACTIVATE MENU _msysmenu PAD reports

8. Save the menu with the name TEST, and then generate the menu.

9. In the Command window, type the following command:

      DO test.mpr

The menu should be activated with the Reports pad open and highlighted.

The above steps will set the default pad only the first time the menu is activated. If a pad is chosen from the menu, and the ALT key is then pressed to activate the menu, the first pad on the menu will be highlighted.

To make the menu appear as if the same default pad is highlighted each time the menu is chosen, turn off ALT key access to the system menu and create an ON KEY LABEL command to activate the menu each time menu access is desired.

To do this:

1. Perform steps 1 through 7 above.

2. In the menu's Setup code, add the following line:

      ON KEY LABEL F10 DO oklf10 IN test.mpr

3. Make sure the Cleanup code of the menu reads as follows:

      ACTIVATE MENU _msysmenu PAD reports
      SET SYSMENU OFF

      PROCEDURE oklf10
      ACTIVATE MENU _msysmenu PAD reports

4. Regenerate the menu.

This menu does not incorporate a foundation READ. If a foundation READ is not included, and the .MPR file is the main program in an executable file, the menu will flash on the screen and then exit. Instructions for adding a foundation READ to a menu are given in article Q87694, here in the Microsoft Knowledge Base.

Additional reference words: MBuilder FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b KBCategory: KBSubcategory: FxtoolMBuilder

Keywords          : kbcode FxtoolMBuilder 
Version           : 2.50b | 2.00 2.50 2.50a 2.50
Platform          : MACINTOSH MS-DOS WINDOWS

Last Reviewed: May 22, 1998