Microsoft KB Archive/127921

{| = DOCERR: Help Gives Misleading Info on Menu General Procedure =
 * width="100%"|

ID: Q127921

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY
The online Help describes the purpose of a general procedure (Procedure Text Region) of an .MNX file as follows:

Procedure Text Region

Defines a procedure for the entire menu system. When any menu pad in the menu system is chosen, this procedure is executed.

MORE INFORMATION
The actual purpose of this text region is to create a procedure that is used when no other code has been assigned to a menu option. In other words, any Command, Bar#, or Procedure assigned to a particular menu pad or option will take precedence over the procedural code placed within this general procedure text region, and the code associated with this general procedure will not be executed.

If there is not any code associated with a created menu pad or option, then by default, the code placed in the general procedure's text region will be executed when that menu pad or option is selected. This is known as a code snippet stub.

The FoxPro for Windows Developer's Guide describes this procedure text region in accurate detail on page D3-26. The FoxPro for MS-DOS Developer's Guide describes this procedure text region on page D3-23.

Steps to View Help Text
To view the topic in the FoxPro for Windows environment, click the Help menu pad on the system menu bar and select Search for Help on... from the list of options. In the text box, type "general options dialog" (without the quotation marks). Press ENTER twice to view the Procedure Text Region topic.

To access this text region while an .MNX file is open, click the Menu pad on the system menu bar, and select General Options from the list of options. The general procedure's text region is accessible from the dialog that appears.

Step-by-Step Menu Example
1. In the Command window, type:

CREATE MENU genproc 2. When GENPROC.MNX appears, type Option1 in the first prompt box. Choose Command as its Result, press the TAB key, and enter this command line:

WAIT WINDOW "Option#1 Selected" 3. Press TAB to move to the next Prompt box, and type Option2. Accept the default Result, and do not assign any code to this option. 4. Press TAB to move to the next Prompt box, and type Exit. Choose Procedure as the Result. Then press the Create push button, and enter the following procedural code for this Exit option:

m.done = .T.  CLEAR READ ALL 5. Click the Menu pad on the system menu bar and choose General Options from the list of options. Then click the Procedure text region, and enter this command line:

WAIT WINDOW "This option is using the menu's General Procedure" 6. Click the Setup check box and enter this command line: m.done = .F. 7. Click the Menu pad on the system menu bar, and choose General Options from the list of options. Choose the Cleanup check box and enter the following command lines:

READ VALID m.done SET SYSMENU TO DEFAULT 8. Save, generate, and run GENPROC.MPR to see how Option1 displays its own code, not the general procedure assigned to the menu. Option2, however, executes the general procedure because no specific code has been assigned to this option. Additional reference words: FoxWin FoxDos 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprg kbdocerr KBSubcategory: FxprgGeneral
 * }