AGI UI PluginsSend comments on this topic.
OnDisplayContextMenu Method (IAgUiPlugin)
See Also
Windows





Windows & Linux

Description

Allows the UI plugin to add its own custom context menus.

Syntax

[Visual Basic .NET]
Public Sub OnDisplayContextMenu( _
    ByVal MenuBuilder As IAgUiPluginContextMenuBuilder _
)
[C#]
public void OnDisplayContextMenu(
    IAgUiPluginContextMenuBuilder MenuBuilder
);
[Managed C++]
public: void OnDisplayContextMenu(
    IAgUiPluginContextMenuBuilder ^ MenuBuilder
);
[Unmanaged C++]
public: HRESULT OnDisplayContextMenu(
    IAgUiPluginContextMenuBuilder * MenuBuilder
);
[Java]
public void onDisplayContextMenu(
    IAgUiPluginContextMenuBuilder MenuBuilder
);

Parameters

MenuBuilder
The menu builder object provided by the hosting environment. The menu builder exposes methods to create custom context menus.

Remarks

The hosting environment calls OnDisplayContextMenu method whenever the context menu associated with a currently selected scenario's element is displayed. User Interface plugins can merge their custom menus to extend the default functionality provided by the hosting environment.

See Also

Example

In the example below, MyFirstContextMenuCommand is a named command which is passed to the IAgUiPluginCommandTarget.Exec method when user clicks on the custom menu item.
Add a custom context menu item.
void IAgUiPlugin.OnDisplayContextMenu(IAgUiPluginMenuBuilder MenuBuilder)
{
//Add a Menu Item
MenuBuilder.AddMenuItem("MyFirstContextMenuCommand", "A CSharp Menu Item", "Open a Custom user interface.", null);
}

© 2025 Analytical Graphics, Inc. All Rights Reserved.