wpInsertMenuItems
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 insert items into its pop-up menu.
Syntax
_wpInsertMenuItems(somSelf, hwndMenu, iPosition, hmod, MenuID, ulSubMenuId)
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
- Handle to the pop-up menu.
- iPosition (ULONG) - input
- Position at which to start inserting items.
- hmod (HMODULE) - input
- Module handle where **MenuID** can be found.
- MenuID (ULONG) - input
- ID of menu to put into pop-up menu.
- For a listing of WPMENUIDs, see the individual object classes.
- ulSubMenuId (ULONG) - input
- ID of submenu to put into pop-up menu.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion.
- FALSE: Error occurred.
Remarks
This instance method will insert all menu items in **ulMenuID MenuID** into the pop-up or pull-down menu. Menu item IDs in open cascade must match corresponding open view. Class-specific menu IDs should be above WPMENUID_USER. The **wpInsertMenuItems** method is a superset of the OS/2 Warp version 3 **wpInsertPopupMenuItems** method. All new or modified object classes that formerly called the wpModifyPopupMenu method should override the **wpInsertMenuItems** method instead. This gives you more control over what menu items are added to or removed from the popup menu as well as the folder pull-down menus.
Usage
This method can be called only during the processing of wpModifyMenu.
How to Override
This method is generally not overridden.
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)); }