Toll Free: (877) 723-1442 U.S. and Canada
Support
ActiveX / COM
Visual C++ / MFC
Customer Spotlight
Corporate Partners
Contact Sales

Call center available M-F 9:00 - 6:00 US Eastern Time.

U.S. and Canada
(877) 723-1442

International
(517) 625-5729

Email

Add MDI Menus customization

Author: Kirk Stowell
Posted: November 16, 2004
Environment: Visual C++ MFC

Xtreme CommandBars has three ways for developers to add MDI Menu customization menus. This tutorial assumes that you have already created an application with customization. Click here for more information about this.

1. Standard MDI Menu customization

This method uses the MFC architecture for MDI menus, you just need to add standard customization without additional changes.

As in a standard MFC application, you must add templates for each MDI document type

Advantages:

  • Ease to add customization
  • Ease to modify standard MFC application

Disadvantages:

  • All disadvantages belong to the user-side. Users must manually customize all templates in the application. For example if the users want to see ‘View’ popup before ’File‘ they must customize each doc template and Main Frame template.

Notes:

  • Be sure that when you create a menu you use a Main Frame identifier


 CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(

     _T("Menu Bar"), IDR_MAINFRAME);



  • See the CustomizeDlg sample for this customization type
  • xtpFlagUseMDIMenus flag no longer used

2. Static MDI Menu customization

All you need is to add the xtpFlagIgnoreSetMenuMessage flag to the Menu Bar:

 CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(

     _T("Menu Bar"), IDR_CUSTOMTYPE);

 pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);

and all other menu templates will be ignored.

Advantages:

  • Ease to add customization
  • Ease to modify standard MFC application
  • Easy for users to customize the application, because they need customize only a single menu used for all templates

Disadvantages

  • Static menus not very flexible for developers to apply some document types

Notes:

  • See CustomThemes sample for this customization type

3. Custom MDI menu customization

This is the most difficult for developers, but the most friendly type for user customization.

Developers must create only one Menu template with all popup items needed to be used in the application, and assign programmatically what popup items are shown in each template.

For example developers must add the ‘Window’ item but assign it to show only when some documents are visible.

For this customization type add ExcludeDocTemplate and AssignDocTemplate methods of CXTPControl class.

Advantages:

  • Easy for users to customize the application, because they need customize only a single menu to be used for all templates

Disadvantages

  • Developers must manually assign the popup items that are visible when the document template is active

Notes:

  • Visual Studio 6.0 and .NET used such customization type. (If you customize the ‘File’ item and open some image to edit, a new ‘Image’ popup appears but the changes in the File section stay the same.)
  • See MDIMenus sample for this customization type

See Also

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other products and/or company names may be trademarks or registered trademarks of their respective owners.