Megosztás a következőn keresztül:


Adding a Coordinated Toolbar and Menu to a Form Set

When you have created a toolbar class and a menu that are designed to work together, it is easy to incorporate them in a form set.

To incorporate a coordinated toolbar and menu in a form set

  1. Add the toolbar to the form set in one of three ways:

    • Drag the toolbar class from the Project Manager into the Form Designer.
    • Register the toolbar class library and add the toolbar to the form set from the Form Controls toolbar.
    • In the Init event of the form set, include code with the AddObject method to add the toolbar.
  2. In the Load event of the form set, save the existing menu and run your menu program.

    For example, if your menu name is mymenu, include the following lines of code using the PUSH MENU and DO commands:

    PUSH MENU _MSYSMENU
    DO mymenu.mpr
    
  3. In the Unload event of the form set, restore the original menu with the POP MENU command:

    POP MENU _MSYSMENU
    

If some menu commands are used more than others, you can create custom toolbars containing buttons for those commands. Then, users can simply press the buttons whenever they need the commands. However, if you create a toolbar, you should synchronize the menu commands with their corresponding buttons. For example, if you enable a button, you should enable its corresponding menu command.

See Also

Creating the Coordinated Menu | Testing and Debugging a Menu System | Creating Custom Toolbars | Customize Toolbar Dialog Box | Designing Menus and Toolbars | Configuring Visual FoxPro