If you want to implement custom context menus from scratch, you should override the following virtual method of the CExtPropertyGridCtrl
class:
virtual void OnPgcContextMenuTrack(
CWnd * pWndHit,
CPoint ptScreen,
CExtGridHitTestInfo * pHtInfo, // can be NULL
CExtPropertyItem * pPropertyItem, // can be NULL
CExtPropertyGridWnd * pPGW // can be NULL
);
Your method should construct and track your popup menu and not invoke parent class method.
But if you want to reconstruct context menus created by default, you should override the following virtual method of the
CExtPropertyGridCtrl
class:
virtual bool OnPgcContextMenuReconstruct(
CExtPopupMenuWnd * pPopup,
CWnd * pWndHit,
CPoint ptScreen,
CExtGridHitTestInfo * pHtInfo, // can be NULL
CExtPropertyItem * pPropertyItem, // can be NULL
CExtPropertyGridWnd * pPGW // can be NULL
);
The
pPopup
menu is constructed and contains default context menu items. You should modify your menu and return
true
if the menu has been successfuly initialized. If your method returns
false
, the
pPopup
menu will not be displayed.