property SwimLane.ContextMenu(Type as ContextMenuObjectTypeEnum) as String
Indicates the object's context menu.

TypeDescription
Type as ContextMenuObjectTypeEnum Indicates the type of the object where the context-menu should be shown.
String A String expression that defines the items to be displayed on the context-menu ( explained bellow ). If empty, no context-menu is shown for the object.

The ContextMenu property defines the default object's context menu. The ActionContextMenu event notifies your application once an action occurs within the object's context menu. Use the AllowContextMenu property to specify the combination of keys that allows the user to open the object's context menu. The ContextMenuFont property retrieves or sets the context-menu's font. The Background(exContextMenuAppearance) property ( and related ) defines the control's context menu appearance. The AllowDesignHeader property on exDesignHeaderLock, specifies that no context-menu is allowed when user hovers the lane/header. Use the InvokeContextMenu methods ( like explained bellow ) to show programmatically the default or any custom context-menu for different objects on the surface.

The following screen shot shows the pool's context menu with a different appearance:

By default, you can provide a context-menu for the following type of objects:

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

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

For instance, the "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 ContextMenu's syntax in BNF notation:

<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.

The following samples show how you can change/handle the element's context-menu when the user right-clicks the element:

VBA (MS Access, Excell...)

' ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
Private Sub SwimLane1_ActionContextMenu(ByVal Action As Long,ByVal ObjectType As Long,ByVal ObjectID As Variant,ByVal CommandID As Long,ByVal CommandChecked As Boolean,ByVal CommandCaption As Variant,ByVal CommandValue As Variant,Cancel As Boolean)
	With SwimLane1
		Debug.Print( Action )
		Debug.Print( CommandCaption )
	End With
End Sub

With SwimLane1
	.BeginUpdate 
	.Elements.Add "element",0,0
	.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
	.EndUpdate 
End With

VB6

' ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
Private Sub SwimLane1_ActionContextMenu(ByVal Action As EXSWIMLANELibCtl.ContextMenuObjectActionEnum,ByVal ObjectType As EXSWIMLANELibCtl.ContextMenuObjectTypeEnum,ByVal ObjectID As Variant,ByVal CommandID As Long,ByVal CommandChecked As Boolean,ByVal CommandCaption As Variant,ByVal CommandValue As Variant,Cancel As Boolean)
	With SwimLane1
		Debug.Print( Action )
		Debug.Print( CommandCaption )
	End With
End Sub

With SwimLane1
	.BeginUpdate 
	.Elements.Add "element",0,0
	.ContextMenu(exContextMenuElement) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
	.EndUpdate 
End With

VB.NET

' ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
Private Sub Exswimlane1_ActionContextMenu(ByVal sender As System.Object,ByVal Action As exontrol.EXSWIMLANELib.ContextMenuObjectActionEnum,ByVal ObjectType As exontrol.EXSWIMLANELib.ContextMenuObjectTypeEnum,ByVal ObjectID As Object,ByVal CommandID As Integer,ByVal CommandChecked As Boolean,ByVal CommandCaption As Object,ByVal CommandValue As Object,ByRef Cancel As Boolean) Handles Exswimlane1.ActionContextMenu
	With Exswimlane1
		Debug.Print( Action )
		Debug.Print( CommandCaption )
	End With
End Sub

With Exswimlane1
	.BeginUpdate()
	.Elements.Add("element",0,0)
	.set_ContextMenu(exontrol.EXSWIMLANELib.ContextMenuObjectTypeEnum.exContextMenuElement,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])")
	.EndUpdate()
End With

VB.NET for /COM

' ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
Private Sub AxSwimLane1_ActionContextMenu(ByVal sender As System.Object, ByVal e As AxEXSWIMLANELib._ISwimLaneEvents_ActionContextMenuEvent) Handles AxSwimLane1.ActionContextMenu
	With AxSwimLane1
		Debug.Print( e.action )
		Debug.Print( e.commandCaption )
	End With
End Sub

With AxSwimLane1
	.BeginUpdate()
	.Elements.Add("element",0,0)
	.set_ContextMenu(EXSWIMLANELib.ContextMenuObjectTypeEnum.exContextMenuElement,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])")
	.EndUpdate()
End With

C++

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
void OnActionContextMenuSwimLane1(long Action,long ObjectType,VARIANT ObjectID,long CommandID,BOOL CommandChecked,VARIANT CommandCaption,VARIANT CommandValue,BOOL FAR* Cancel)
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'EXSWIMLANELib' for the library: 'ExSwimLane 1.0 Control Library'
		#import <ExSwimLane.dll>
		using namespace EXSWIMLANELib;
	*/
	EXSWIMLANELib::ISwimLanePtr spSwimLane1 = GetDlgItem(IDC_SWIMLANE1)->GetControlUnknown();
	OutputDebugStringW( L"Action" );
	OutputDebugStringW( L"CommandCaption" );
}

EXSWIMLANELib::ISwimLanePtr spSwimLane1 = GetDlgItem(IDC_SWIMLANE1)->GetControlUnknown();
spSwimLane1->BeginUpdate();
spSwimLane1->GetElements()->Add("element",long(0),long(0));
spSwimLane1->PutContextMenu(EXSWIMLANELib::exContextMenuElement,L"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])");
spSwimLane1->EndUpdate();

C++ Builder

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
void __fastcall TForm1::SwimLane1ActionContextMenu(TObject *Sender,Exswimlanelib_tlb::ContextMenuObjectActionEnum Action,Exswimlanelib_tlb::ContextMenuObjectTypeEnum ObjectType,Variant ObjectID,long CommandID,VARIANT_BOOL CommandChecked,Variant CommandCaption,Variant CommandValue,VARIANT_BOOL * Cancel)
{
	OutputDebugString( L"Action" );
	OutputDebugString( L"CommandCaption" );
}

SwimLane1->BeginUpdate();
SwimLane1->Elements->Add(TVariant("element"),TVariant(0),TVariant(0));
SwimLane1->ContextMenu[Exswimlanelib_tlb::ContextMenuObjectTypeEnum::exContextMenuElement] = L"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])";
SwimLane1->EndUpdate();

C#

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
private void exswimlane1_ActionContextMenu(object sender,exontrol.EXSWIMLANELib.ContextMenuObjectActionEnum Action,exontrol.EXSWIMLANELib.ContextMenuObjectTypeEnum ObjectType,object ObjectID,int CommandID,bool CommandChecked,object CommandCaption,object CommandValue,ref bool Cancel)
{
	System.Diagnostics.Debug.Print( Action.ToString() );
	System.Diagnostics.Debug.Print( CommandCaption.ToString() );
}
//this.exswimlane1.ActionContextMenu += new exontrol.EXSWIMLANELib.exg2antt.ActionContextMenuEventHandler(this.exswimlane1_ActionContextMenu);

exswimlane1.BeginUpdate();
exswimlane1.Elements.Add("element",0,0);
exswimlane1.set_ContextMenu(exontrol.EXSWIMLANELib.ContextMenuObjectTypeEnum.exContextMenuElement,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])");
exswimlane1.EndUpdate();

JScript/JavaScript

<BODY onload="Init()">
<SCRIPT FOR="SwimLane1" EVENT="ActionContextMenu(Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel)" LANGUAGE="JScript">
	alert( Action );
	alert( CommandCaption );
</SCRIPT>

<OBJECT CLASSID="clsid:AFA73FCE-6609-4062-AE6A-4BAD6D96A025" id="SwimLane1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	SwimLane1.BeginUpdate();
	SwimLane1.Elements.Add("element",0,0);
	SwimLane1.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])";
	SwimLane1.EndUpdate();
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<SCRIPT LANGUAGE="VBScript">
Function SwimLane1_ActionContextMenu(Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel)
	With SwimLane1
		alert( Action )
		alert( CommandCaption )
	End With
End Function
</SCRIPT>

<OBJECT CLASSID="clsid:AFA73FCE-6609-4062-AE6A-4BAD6D96A025" id="SwimLane1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With SwimLane1
		.BeginUpdate 
		.Elements.Add "element",0,0
		.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
		.EndUpdate 
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
private void axSwimLane1_ActionContextMenu(object sender, AxEXSWIMLANELib._ISwimLaneEvents_ActionContextMenuEvent e)
{
	System.Diagnostics.Debug.Print( e.action.ToString() );
	System.Diagnostics.Debug.Print( e.commandCaption.ToString() );
}
//this.axSwimLane1.ActionContextMenu += new AxEXSWIMLANELib._ISwimLaneEvents_ActionContextMenuEventHandler(this.axSwimLane1_ActionContextMenu);

axSwimLane1.BeginUpdate();
axSwimLane1.Elements.Add("element",0,0);
axSwimLane1.set_ContextMenu(EXSWIMLANELib.ContextMenuObjectTypeEnum.exContextMenuElement,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])");
axSwimLane1.EndUpdate();

X++ (Dynamics Ax 2009)

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
void onEvent_ActionContextMenu(int _Action,int _ObjectType,COMVariant _ObjectID,int _CommandID,boolean _CommandChecked,COMVariant _CommandCaption,COMVariant _CommandValue,COMVariant /*bool*/ _Cancel)
{
	;
	print( _Action );
	print( _CommandCaption );
}

public void init()
{
	;

	super();

	exswimlane1.BeginUpdate();
	exswimlane1.Elements().Add("element",COMVariant::createFromInt(0),COMVariant::createFromInt(0));
	exswimlane1.ContextMenu(4/*exContextMenuElement*/,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])");
	exswimlane1.EndUpdate();
}

Delphi 8 (.NET only)

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
procedure TWinForm1.AxSwimLane1_ActionContextMenu(sender: System.Object; e: AxEXSWIMLANELib._ISwimLaneEvents_ActionContextMenuEvent);
begin
	with AxSwimLane1 do
	begin
		OutputDebugString( e.action );
		OutputDebugString( e.commandCaption );
	end
end;

with AxSwimLane1 do
begin
	BeginUpdate();
	Elements.Add('element',TObject(0),TObject(0));
	set_ContextMenu(EXSWIMLANELib.ContextMenuObjectTypeEnum.exContextMenuElement,'Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])');
	EndUpdate();
end

Delphi (standard)

// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
procedure TForm1.SwimLane1ActionContextMenu(ASender: TObject; Action : ContextMenuObjectActionEnum;ObjectType : ContextMenuObjectTypeEnum;ObjectID : OleVariant;CommandID : Integer;CommandChecked : WordBool;CommandCaption : OleVariant;CommandValue : OleVariant;var Cancel : WordBool);
begin
	with SwimLane1 do
	begin
		OutputDebugString( Action );
		OutputDebugString( CommandCaption );
	end
end;

with SwimLane1 do
begin
	BeginUpdate();
	Elements.Add('element',OleVariant(0),OleVariant(0));
	ContextMenu[EXSWIMLANELib_TLB.exContextMenuElement] := 'Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])';
	EndUpdate();
end

VFP

*** ActionContextMenu event - Occurs when the user selects an item from the object's context menu. ***
LPARAMETERS Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel
	with thisform.SwimLane1
		DEBUGOUT( Action )
		DEBUGOUT( CommandCaption )
	endwith

with thisform.SwimLane1
	.BeginUpdate
	.Elements.Add("element",0,0)
	.Object.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
	.EndUpdate
endwith

dBASE Plus

/*
with (this.EXSWIMLANEACTIVEXCONTROL1.nativeObject)
	ActionContextMenu = class::nativeObject_ActionContextMenu
endwith
*/
// Occurs when the user selects an item from the object's context menu.
function nativeObject_ActionContextMenu(Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel)
	local oSwimLane
	oSwimLane = form.EXSWIMLANEACTIVEXCONTROL1.nativeObject
	? Str(Action) 
	? Str(CommandCaption) 
return

local oSwimLane

oSwimLane = form.EXSWIMLANEACTIVEXCONTROL1.nativeObject
oSwimLane.BeginUpdate()
oSwimLane.Elements.Add("element",0,0)
oSwimLane.Template = [ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"] // oSwimLane.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
oSwimLane.EndUpdate()

XBasic (Alpha Five)

' Occurs when the user selects an item from the object's context menu.
function ActionContextMenu as v (Action as OLE::Exontrol.SwimLane.1::ContextMenuObjectActionEnum,ObjectType as OLE::Exontrol.SwimLane.1::ContextMenuObjectTypeEnum,ObjectID as A,CommandID as N,CommandChecked as L,CommandCaption as A,CommandValue as A,Cancel as L)
	Dim oSwimLane as P
	oSwimLane = topparent:CONTROL_ACTIVEX1.activex
	? Action 
	? CommandCaption 
end function

Dim oSwimLane as P

oSwimLane = topparent:CONTROL_ACTIVEX1.activex
oSwimLane.BeginUpdate()
oSwimLane.Elements.Add("element",0,0)
oSwimLane.Template = "ContextMenu(4) = `Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])`" // oSwimLane.ContextMenu(4) = "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
oSwimLane.EndUpdate()

Visual Objects

METHOD OCX_Exontrol1ActionContextMenu(Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel) CLASS MainDialog
	// ActionContextMenu event - Occurs when the user selects an item from the object's context menu.
	OutputDebugString(String2Psz( AsString(Action) ))
	OutputDebugString(String2Psz( AsString(CommandCaption) ))
RETURN NIL


oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:Elements:Add("element",0,0)
oDCOCX_Exontrol1:[ContextMenu,exContextMenuElement] := "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
oDCOCX_Exontrol1:EndUpdate()

PowerBuilder

/*begin event ActionContextMenu(long Action,long ObjectType,any ObjectID,long CommandID,boolean CommandChecked,any CommandCaption,any CommandValue,boolean Cancel) - Occurs when the user selects an item from the object's context menu.*/
/*
	OleObject oSwimLane
	oSwimLane = ole_1.Object
	MessageBox("Information",string( String(Action) ))
	MessageBox("Information",string( String(CommandCaption) ))
*/
/*end event ActionContextMenu*/

OleObject oSwimLane

oSwimLane = ole_1.Object
oSwimLane.BeginUpdate()
oSwimLane.Elements.Add("element",0,0)
oSwimLane.ContextMenu(4,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])")
oSwimLane.EndUpdate()

Visual DataFlex

// Occurs when the user selects an item from the object's context menu.
Procedure OnComActionContextMenu OLEContextMenuObjectActionEnum llAction OLEContextMenuObjectTypeEnum llObjectType Variant llObjectID Integer llCommandID Boolean llCommandChecked Variant llCommandCaption Variant llCommandValue Boolean llCancel
	Forward Send OnComActionContextMenu llAction llObjectType llObjectID llCommandID llCommandChecked llCommandCaption llCommandValue llCancel
	Showln llAction llCommandCaption
End_Procedure

Procedure OnCreate
	Forward Send OnCreate
	Send ComBeginUpdate
	Variant voElements
	Get ComElements to voElements
	Handle hoElements
	Get Create (RefClass(cComElements)) to hoElements
	Set pvComObject of hoElements to voElements
		Get ComAdd of hoElements "element" 0 0 to Nothing
	Send Destroy to hoElements
	Set ComContextMenu OLEexContextMenuElement to "Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])"
	Send ComEndUpdate
End_Procedure

XBase++

PROCEDURE OnActionContextMenu(oSwimLane,Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel)
	DevOut( Transform(Action,"") )
	DevOut( Transform(CommandCaption,"") )
RETURN

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oSwimLane

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oSwimLane := XbpActiveXControl():new( oForm:drawingArea )
	oSwimLane:CLSID  := "Exontrol.SwimLane.1" /*{AFA73FCE-6609-4062-AE6A-4BAD6D96A025}*/
	oSwimLane:create(,, {10,60},{610,370} )

		oSwimLane:ActionContextMenu := {|Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel| OnActionContextMenu(oSwimLane,Action,ObjectType,ObjectID,CommandID,CommandChecked,CommandCaption,CommandValue,Cancel)} /*Occurs when the user selects an item from the object's context menu.*/

		oSwimLane:BeginUpdate()
		oSwimLane:Elements():Add("element",0,0)
		oSwimLane:SetProperty("ContextMenu",4/*exContextMenuElement*/,"Simple,Value[edit=123],[sep],Popup(Check 1[chk],Check 2[chk=1])")
		oSwimLane:EndUpdate()

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN