Contents - Index - Top


CreateContextMenuItem

Interface AntView 

 

Type: Method

Parameters: String Label AntViewContextMenuIcon Icon TxContextMenuItemKind Kind

Returns: AntViewContextMenuItem

 

 

Create a new context menu item to be used in the context menu of the AntView control.

If you don't have an icon then pass a null dispatch variable for the Icon parameter.

 

Please note that each menu item is cached by WebView2 control. In order to make that caching mechanism work reliably the AntView control has to cache the  ICoreWebView2ContextMenuItem dispatches as well as otherwise the WebView2 logic gets easily confused. The AntView caching mechanism is completely transparent when creating menu items via the CreateContextMenu method. If the label, iconpath and "Kind" match a menu item that was created previously, then it will use the cached menu item automatically. If it wasn't created previously then the menu item will be created and added to the list of cached menu items.

 

It is also important to know that the WebView2 control itself has a hard limit of 1000 context menu items that can be created. 

The AntView caching mechanism helps with preventing to hit that limit.

 

Examples:

VB6 - Custom Context Menu example

VFP - Custom Context Menu example

 

Introduced in AntView release 2.0.567

 


AntView - The MS Edge WebView2 ActiveX control Date last changed: 11/05/2025