method Elements.InvokeContextMenu ([ContextMenu as Variant])
Invokes programmatically the selection's default or customized context menu, and returns the identifier of the selected item.

TypeDescription
ContextMenu as Variant A String expression that defines the items to be displayed on the selection's context-menu. If empty, the default context-menu for selection [ContextMenu(exContextMenuSelection) property] is shown.
ReturnDescription
VariantA Long expression that indicates the identifier of the item being selected/clicked.
The InvokeContextMenu method invokes programmatically the selection's default or customized context menu, and returns the identifier of the selected item. The ContextMenu(exContextMenuSelection) property defines the default content-menu for selection. The ActionContextMenu event notifies your application once an action occurs within the object's context menu. Use the AllowContextMenu property on exDisallow to disable default's context menu, when the user right clicks the selection. The ContextMenuFont property retrieves or sets the context-menu's font. The Background(exContextMenuAppearance) property ( and related ) defines the control's context menu appearance.

By default, the selection's context-menu shows as follows:

For instance, the InvokeContextMenu( "Item 1,Item 2,[sep],Check 1[chk],Check 2[chk]" ), generates the following screen shot:

For instance, the InvokeContextMenu( "Item 1,Item 2,Popup(Check 1[chk],Check 2[chk])" ), generates the following screen shot:

For instance, the InvokeContextMenu( "Calendar[id=20][img=0],MSChart[id=30],Record[id=40],Slider[id=50],Radio 1[id=100][typ=2][edit=],Radio 2[id=101][typ=2][edit=],Radio 3[id=102][typ=2][edit=],ComboBox[id=90]" ), generates the following screen shot:

The syntax for ContextMenu parameter in BNF notation is:

<ToString> ::= <ITEMS>
<ITEMS> ::= <ITEM>["("<ITEMS>")"][","<ITEMS>]
<ITEM> ::= <CAPTION>[<OPTIONS>]
<OPTIONS> ::= "["<OPTION>"]"["["<OPTIONS>"]"]
<OPTION> ::= <PROPERTY>["="<VALUE>]
<PROPERTY> ::= "img" | "himg" | "sep" | "id" | "typ" | "group" | "chk" | "button" | "align" | "spchk" | "show" | "rad" | "dis" | "showdis" | "bld" | "itl" | "stk" | "und" | "bg" | "fg" | "edittype" | "edit" | "mask" | "border" | "editwidth" | "captionwidth" | "height" | "grp" | "tfi" | "ttp" | "min" | "max" | "tick" | "freq" | "ticklabel" | "small" | "large" | "spin" | "ettp" | "float" | "close"

where the <CAPTION> is the HTML caption to be shown on the context menu item. The <VALUE> indicates the value of giving property.