Jump to content

wpModifyPopupMenu

From EDM2

This instance method is called to allow an object to add additional items to its pop-up menu.

Syntax

_wpModifyPopupMenu(somSelf, hwndMenu, hwndCnr, iPosition)

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.

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 menu is made. This method is called following a call to the wpFilterPopupMenu method.

How to Override

This method should be overridden in order to add class-specific actions to the object's pop-up menu. Descendant classes can remove these actions by processing the wpFilterPopupMenu 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_wpModifyPopupMenu(MYFOLDER *somSelf,
                                 HWND hwndMenu,
                                 HWND hwndCnr,
                                 ULONG iPosition)

{
    HMODULE   hmod = NULLHANDLE;
    zString   zsPathName;

    /* MYFOLDERData *somThis = MYFOLDERGetData(somSelf); */
    MYFOLDERMethodDebug("MYFOLDER","myfold_wpModifyPopupMenu");

    hmod = _clsQueryModuleHandle(_MYFOLDER);
    if (hmod)
    {
       _wpInsertPopupMenuItems( somSelf, hwndMenu, 0, hmod, ID_CLOSEVIEWSMENU, 0);
    }

    return (parent_wpModifyPopupMenu(somSelf,hwndMenu,hwndCnr,iPosition));
}