Context Menu Customization

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
tembreull
User
Posts: 6
Joined: Tue Jun 21, 2016 8:18 pm

Context Menu Customization

Post by tembreull »

Is there a way to add/remove items from the existing context menus. For example, is it possible to add an "Add Stamp" menu just below the "Add Sticky Note" menu item?

Thanks,
Scott
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Context Menu Customization

Post by Sasha - Tracker Dev Team »

Hello tembreull,

You will need to listen to the e.beforeShowContextMenu event and then do something like in this sample:

Code: Select all


CComPtr<PXV::IPXV_Inst> pInst;
....

LONG nNecessaryMenuID;
pInst->Str2ID(CComBSTR(L"menu.tool.selectText"), &nNecessaryMenuID);
....

CComPtr<PXV::IPXV_BeforeShowContextMenuEvent> pMenuEvt;
pEvent->QueryInterface(&pMenuEvt);
if (pMenuEvt == nullptr)
	return;

LONG nMenuID = 0;
pMenuEvt->get_MenuID(&nMenuID);

if (nMenuID != nNecessaryMenuID)
	return;

CComPtr<PXV::IUIX_CmdMenu> pMenu;
pMenuEvt->get_Menu(&pMenu);
if (pMenu == nullptr)
	return;
And then you can insert or remove needed items.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ