Copyright: Pop-up Menu Component Help


Pop Up-Menu Component: Overview
Pop-Up Menu Component: Overview

The Pop-Up Menu component adds a pop-up menu to a CWnd-derived class in your project. When the user clicks with the right-mouse button on a window of this class, a menu appears. This menu initially contains the items Cut, Copy and Paste. Note that no code is attached to these menu items. They are used to demonstrate the existence of the pop-up menu.

After you have inserted this component, you add items to this menu and create handlers for these menu items using the resource editor and ClassWizard.

•	Pop-Up Menu Component: Specifics

•	Pop-Up Menu Component: Results


Pop Up-Menu Component: Specifics
Pop-Up Menu Component: Specifics

The Popup-Menu Component adds a popup menu, implemented with a CWnd-derived class, to your application. In addition, a sample menu with the entries Cut, Copy and Paste and a message handler (called OnContextHandler) for this menu are added to the project.

When you insert this component you will be shown a list of CWnd-derived classes in your project. Select the desired class, and choose the Next button. You will then be given a suggested name for the ID of the new menu resource, which you can change. Choosing the Finish button completes the insertion.


Pop Up-Menu Component: Results
Pop-Up Menu Component: Results

The following changes are implemented in your project upon successful insertion of the component:

•	A message handler, called OnContextMenu, for the selected CWnd-derived class.

This message handler handles the notification for the pop-up menu.

•	A CWnd-derived class that implements the pop-up menu.

•	A sample menu with three entries; Cut, Copy and Paste.

This menu is for example only; the menu items are not active and need to be modified for your application’s needs.

•	A resource ID for the pop-up menu.

This resource ID is used to access the menu resource when creating the menu.