HOWTO: Using SET SKIP OF PAD with Custom Menu Pad

This article was previously published under Q116271
This article has been archived. It is offered "as is" and will no longer be updated.
In order for the SET SKIP OF PAD <pad name> OF <menu name> .T. command towork on a menu created with the FoxPro Menu Builder, the menu pad name mustbe given a user-assigned name. The Menu Prompt Options dialog box containsa Pad Name check box that can be used to assign a name to a menu pad. Thatname can then later be used to refer to that pad name in the SET SKIP OFPAD command.
In a menu created with the Quick Menu command, each standard menu pad isautomatically assigned a name according to the "MENU - System Menu Names"section of the FoxPro 2.6 "Language Reference" manual, or in Visual FoxProonline Help, under the topic "Menu Names, Visual FoxPro System (internal)".

However, in a custom menu prompt, if the Pad Name check box is notselected, the pad is automatically assigned a unique name, such as_qp70zgq9j, by the GENMENU menu generator. This unique pad name cannot bereferred to since it is assigned dynamically each time the menu isgenerated. If this unique name is referred to, unexpected behavior willoccur during a SET SKIP OF PAD command.

To illustrate how to work around this behavior, the following steps willcreate a new menu system with three pads, assign a pad name to the secondpad, and allow the second pad to be enabled or disabled by selecting thethird pad:
  1. From the File menu, choose New. Under File Type, select Menu, and then choose New. Or, type CREATE MENU in the Command window.
  2. In the Prompt box, type Exit. In the Result box, select Command. In the text box, type SET SYSMENU TO DEFAULT. Press the TAB key twice, or click the next Prompt box.
  3. In the second Prompt box, type Admin. In the Result box, select Procedure. Choose the Create button. In the window, type the following:
          WAIT WINDOW "You chose the Admin pad from the menu"						
    Press CTRL+W to close the edit window.
  4. Press the TAB key once, or click the Options button. In the Prompt Options dialog box, select the Pad Name check box. In the Pad Name box, type Admin. Choose OK twice. Press the TAB key once, or click the next Prompt box.
  5. In the third Prompt box, type Toggle Admin. In the Result box, select Procedure. Choose the Create button. In the window, type the following code:
          tadmin = NOT tadmin      SET SKIP OF PAD admin OF _msysmenu tadmin						
    Then press CTRL+W to close the window.
  6. From the Menu menu in FoxPro 2.x (the View menu in Visual FoxPro), choose General Options, select the Setup check box under Menu Code, choose OK, and then enter the following code in the window:
          PUBLIC tadmin      tadmin = .F.						
    Then press CTRL+W to close the window.
  7. From the File menu, choose Save As. In the Save Menu As text box, type testskip. Choose the Save button.
  8. From the Program menu, choose Generate, and then choose the Generate button. When FoxPro has finished generating the menu, press ESC or choose Close from the File menu to close the Menu Builder window.
To test the menu, either type DO testskip.mpr in the Command window, or choose Do from the Program menu, selectthe TESTSKIP.MPR file, and then choose the Do button.

Note that the Admin menu is enabled at first and is dimmed after the ToggleAdmin menu is chosen.
MBuilder not working ignored cannot dim disabled enabled greyed grayed unavailable

Article ID: 116271 - Last Review: 02/28/2014 07:55:10 - Revision: 2.1

Microsoft Visual FoxPro 3.0 Standard Edition, Microsoft FoxPro 2.0, Microsoft FoxPro 2.6a Professional Edition for Macintosh

  • kbnosurvey kbarchive KB116271