event AllowLink (ElementFrom as Element, ElementTo as Element, ByRef Cancel as Boolean)
Occurs when the user links an element with another element.

TypeDescription
ElementFrom as Element An Element object that specifies where the link starts from.
ElementTo as Element An Element object that specifies where the link ends to.
Cancel as Boolean (By Reference) A Boolean expression that specifies whether the operation is canceled or allowed, or if the link will or will not be added.
The AllowLink event occurs when user links two elements to specify whether the link is allowed. For instance, you can use the PathTo property of the Element object to check if there is a path from an element to another, so avoid cycles. The CreateLink event occurs when the user links two elements on the surface. The AllowLinkObjects property specifies the keys combination to let the user links two elements on the surface, the ElementFrom property specifies the element where the link starts, where the ElementTo property specifies ending element of the link. Prior to CreateLink event the control fires the AddLink event that indicates that the link has been added to the Links collection. You can use the Remove method to remove the link. The Background(exLinkObjectsInvalidColor) property specifies the color to show the invalid link. The Background(exLinkObjectsValidColor) property specifies the color to show the valid link.

The following VB sample prevents adding cycles to the chart:

Private Sub SwimLane1_AllowLink(ByVal ElementFrom As EXSWIMLANELibCtl.IElement, ByVal ElementTo As EXSWIMLANELibCtl.IElement, Cancel As Boolean)
    Cancel = ElementTo.PathTo(ElementFrom)
End Sub

The order of the events when the user links two elements at runtime is:

The AllowLink event is not called during the LoadXML method.

Syntax for AllowLink event, /NET version, on:

private void AllowLink(object sender,exontrol.EXSWIMLANELib.Element ElementFrom,exontrol.EXSWIMLANELib.Element ElementTo,ref bool Cancel)
{
}

Private Sub AllowLink(ByVal sender As System.Object,ByVal ElementFrom As exontrol.EXSWIMLANELib.Element,ByVal ElementTo As exontrol.EXSWIMLANELib.Element,ByRef Cancel As Boolean) Handles AllowLink
End Sub

Syntax for AllowLink event, /COM version, on:

private void AllowLink(object sender, AxEXSWIMLANELib._ISwimLaneEvents_AllowLinkEvent e)
{
}

void OnAllowLink(LPDISPATCH ElementFrom,LPDISPATCH ElementTo,BOOL FAR* Cancel)
{
}

void __fastcall AllowLink(TObject *Sender,Exswimlanelib_tlb::IElement *ElementFrom,Exswimlanelib_tlb::IElement *ElementTo,VARIANT_BOOL * Cancel)
{
}

procedure AllowLink(ASender: TObject; ElementFrom : IElement;ElementTo : IElement;var Cancel : WordBool);
begin
end;

procedure AllowLink(sender: System.Object; e: AxEXSWIMLANELib._ISwimLaneEvents_AllowLinkEvent);
begin
end;

begin event AllowLink(oleobject ElementFrom,oleobject ElementTo,boolean Cancel)
end event AllowLink

Private Sub AllowLink(ByVal sender As System.Object, ByVal e As AxEXSWIMLANELib._ISwimLaneEvents_AllowLinkEvent) Handles AllowLink
End Sub

Private Sub AllowLink(ByVal ElementFrom As EXSWIMLANELibCtl.IElement,ByVal ElementTo As EXSWIMLANELibCtl.IElement,Cancel As Boolean)
End Sub

Private Sub AllowLink(ByVal ElementFrom As Object,ByVal ElementTo As Object,Cancel As Boolean)
End Sub

LPARAMETERS ElementFrom,ElementTo,Cancel

PROCEDURE OnAllowLink(oSwimLane,ElementFrom,ElementTo,Cancel)
RETURN

Syntax for AllowLink event, /COM version (others), on:

<SCRIPT EVENT="AllowLink(ElementFrom,ElementTo,Cancel)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function AllowLink(ElementFrom,ElementTo,Cancel)
End Function
</SCRIPT>

Procedure OnComAllowLink Variant llElementFrom Variant llElementTo Boolean llCancel
	Forward Send OnComAllowLink llElementFrom llElementTo llCancel
End_Procedure

METHOD OCX_AllowLink(ElementFrom,ElementTo,Cancel) CLASS MainDialog
RETURN NIL

void onEvent_AllowLink(COM _ElementFrom,COM _ElementTo,COMVariant /*bool*/ _Cancel)
{
}

function AllowLink as v (ElementFrom as OLE::Exontrol.SwimLane.1::IElement,ElementTo as OLE::Exontrol.SwimLane.1::IElement,Cancel as L)
end function

function nativeObject_AllowLink(ElementFrom,ElementTo,Cancel)
return