wpModifyMenu
This method is specific to Version 4, or higher, of the OS/2 operating system.
This instance method is called to allow an object to add additional items to its pop-up menu.
Syntax
_wpModifyMenu(somSelf, hwndMenu, hwndCnr, iPosition, ulMenuType, ulView, ulReserved)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
- hwndMenu (HWND) - input
- Menu handle.
- hwndCnr (HWND) - input
- Handle to container control window.
- iPosition (ULONG) - input
- Position to insert menu items.
- ulMenuType (ULONG) - input
- The type of menu that is being built.
- Can be any one of the following values:
- MENU_OBJECTPOPUP: Pop-up menu for the object icon.
- MENU_OPENVIEWPOPUP: Pop-up menu for an open view.
- MENU_FOLDERPULLDOWN: Pull-down menu for a folder.
- MENU_EDITPULLDOWN: Pull-down menu for the Edit menu option.
- MENU_VIEWPULLDOWN: Pull-down menu for the View menu option.
- MENU_SELECTEDPULLDOWN: Pull-down menu for the Selected menu option.
- MENU_HELPPULLDOWN: Pull-down menu for the Help menu option.
- ulView (ULONG) - input
- The view that the menu is being invoked on.
- OPEN_CONTENTS: Open contents view.
- OPEN_TREE: Open tree view.
- OPEN_DETAILS: Open details view.
- CLOSED_ICON: Closed icon view.
- ulReserved (ULONG) - input
- Reserved. Set to 0.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion.
- FALSE: Error occurred.
Remarks
Class-specific menu IDs should be above WPMENUID_USER. This method should be called only if the current pop-up menu applies to objects of the same class.
Usage
This method is generally called by the system when a request to display the object's pop-up or pull-down menu is made. This method is called following a call to the wpFilterMenu method.
How to Override
This method should be overridden in order to add class-specific actions to the object's pop-up or pull-down menu. Descendant classes can remove these actions by processing the wpFilterMenu method.
Example Code
This example adds an extra option to the context menu to close all but the first view.
SOM_Scope BOOL SOMLINK myfold_wpModifyMenu(MYFOLDER *somSelf, HWND hwndMenu, HWND hwndCnr, ULONG iPosition, ULONG ulMenuType, ULONG ulView, ULONG ulReserved) { HMODULE hmod = NULLHANDLE; zString zsPathName; /* MYFOLDERData *somThis = MYFOLDERGetData(somSelf); */ MYFOLDERMethodDebug("MYFOLDER","myfold_wpModifyMenu"); if (ulMenuType == MENU_OPENVIEWPOPUP) { /* This is a pop-up menu - add options to the menu */ hmod = _clsQueryModuleHandle(_MYFOLDER); if (hmod) { _wpInsertMenuItems( somSelf, hwndMenu, 0, hmod, ID_CLOSEVIEWSMENU, 0); } } return (parent_wpModifyMenu(somSelf, hwndMenu, hwndCnr, iPosition, ulMenuType, ulView, ulReserved)); }