Show context menus
- Last UpdatedJul 23, 2024
- 1 minute read
When user tries to show context menu with right mouse click in an extension view, depending on context it might show object context menu or its own context menu (defined by itself in the manifest). IDE facilitates this functionality for the extensions. Following are two examples, one showing object context menu and other showing extension defined context menu. These methods should be invoked in the MouseUp event handler when right mouse button is clicked.
private void OnShowContextMenu()
{
IaaMenu menu = m_site.Services[typeof(IaaMenu)] as IaaMenu;
// Display object context menu
if(menu != null)
menu.ShowPopup ();
}
private void OnShowContextMenu()
{
IaaMenus menus = m_site.Services[typeof(IaaMenus)] as IaaMenus;
if(menus != null)
{
IaaMenu menu = menus[“MyContextMenu”];
// Display extension’s context menu
if(menu != null)
menu.ShowPopup();
}
}