Type | Description | |||
From as Element | An Element object where the link starts. The ElementFrom property of the Link indicates the element where the link starts. | |||
To as Element | An Element object where the link ends. The ElementTo property of the Link indicates the element where the link ends. | |||
ID as Variant | A Long, String or Numeric expression that indicates the unique identifier of the link. If missing, the control will automatically generate an unique identifier. The ID property specifies the link's identifier. |
Return | Description | |||
Link | A Link object being created. |
.Use the Add method to programmatically add new link to the surface. The AddLink event notifies your application once a new link is added to the Links collection. Calling programmatically the Add method does NOT fire the CreateLink or AllowLink events. The Remove method removes a link from the surface. The Clear method clears all the links on the surface. The StartPos/EndPos properties indicates where on the starting element links starts and where on the ending elements the link ends. The ShowLinks property specifies whether the surface shows or hides the links. The OutgoingLinks property returns a safe array of outgoing links ( links that starts from the element ). The IncomingLinks property returns a safe array of incoming links ( links that ends on the element ). The AllowLinkObjects property specifies the combination of keys that allows the user to link the objects. The Arrange( ID ) method arranges the elements starting from element with the specified ID. If missing, all linked-elements are arranged.
The following screen shot shows the surface with different type of links:
The order of the events when the user links two elements at runtime is:
The following samples show how you can add programmatically a link:
VBA (MS Access, Excell...)
With SwimLane1 With .Elements .Add "Element <sha ;;0>A" .Add "Element <sha ;;0>B",96,24 End With With .Links .Add SwimLane1.Elements.item(1),SwimLane1.Elements.item(2) End With End With
VB6
With SwimLane1 With .Elements .Add "Element <sha ;;0>A" .Add "Element <sha ;;0>B",96,24 End With With .Links .Add SwimLane1.Elements.item(1),SwimLane1.Elements.item(2) End With End With
VB.NET
With Exswimlane1 With .Elements .Add("Element <sha ;;0>A") .Add("Element <sha ;;0>B",96,24) End With With .Links .Add(Exswimlane1.Elements.get_item(1),Exswimlane1.Elements.get_item(2)) End With End With
VB.NET for /COM
With AxSwimLane1 With .Elements .Add("Element <sha ;;0>A") .Add("Element <sha ;;0>B",96,24) End With With .Links .Add(AxSwimLane1.Elements.item(1),AxSwimLane1.Elements.item(2)) End With End With
C++
/* 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(); EXSWIMLANELib::IElementsPtr var_Elements = spSwimLane1->GetElements(); var_Elements->Add("Element <sha ;;0>A",vtMissing,vtMissing); var_Elements->Add("Element <sha ;;0>B",long(96),long(24)); EXSWIMLANELib::ILinksPtr var_Links = spSwimLane1->GetLinks(); var_Links->Add(spSwimLane1->GetElements()->Getitem(long(1)),spSwimLane1->GetElements()->Getitem(long(2)),vtMissing);
C++ Builder
Exswimlanelib_tlb::IElementsPtr var_Elements = SwimLane1->Elements; var_Elements->Add(TVariant("Element <sha ;;0>A"),TNoParam(),TNoParam()); var_Elements->Add(TVariant("Element <sha ;;0>B"),TVariant(96),TVariant(24)); Exswimlanelib_tlb::ILinksPtr var_Links = SwimLane1->Links; var_Links->Add(SwimLane1->Elements->get_item(TVariant(1)),SwimLane1->Elements->get_item(TVariant(2)),TNoParam());
C#
exontrol.EXSWIMLANELib.Elements var_Elements = exswimlane1.Elements; var_Elements.Add("Element <sha ;;0>A",null,null); var_Elements.Add("Element <sha ;;0>B",96,24); exontrol.EXSWIMLANELib.Links var_Links = exswimlane1.Links; var_Links.Add(exswimlane1.Elements[1],exswimlane1.Elements[2],null);
JavaScript
<OBJECT classid="clsid:AFA73FCE-6609-4062-AE6A-4BAD6D96A025" id="SwimLane1"></OBJECT> <SCRIPT LANGUAGE="JScript"> var var_Elements = SwimLane1.Elements; var_Elements.Add("Element <sha ;;0>A",null,null); var_Elements.Add("Element <sha ;;0>B",96,24); var var_Links = SwimLane1.Links; var_Links.Add(SwimLane1.Elements.item(1),SwimLane1.Elements.item(2),null); </SCRIPT>
C# for /COM
EXSWIMLANELib.Elements var_Elements = axSwimLane1.Elements; var_Elements.Add("Element <sha ;;0>A",null,null); var_Elements.Add("Element <sha ;;0>B",96,24); EXSWIMLANELib.Links var_Links = axSwimLane1.Links; var_Links.Add(axSwimLane1.Elements[1],axSwimLane1.Elements[2],null);
X++ (Dynamics Ax 2009)
public void init() { COM com_Elements,com_Links; anytype var_Elements,var_Links; ; super(); var_Elements = exswimlane1.Elements(); com_Elements = var_Elements; com_Elements.Add("Element <sha ;;0>A"); com_Elements.Add("Element <sha ;;0>B",COMVariant::createFromInt(96),COMVariant::createFromInt(24)); var_Links = exswimlane1.Links(); com_Links = var_Links; com_Links.Add(COM::createFromObject(exswimlane1.Elements()).item(COMVariant::createFromInt(1)),COM::createFromObject(exswimlane1.Elements()).item(COMVariant::createFromInt(2))); }
Delphi 8 (.NET only)
with AxSwimLane1 do begin with Elements do begin Add('Element <sha ;;0>A',Nil,Nil); Add('Element <sha ;;0>B',TObject(96),TObject(24)); end; with Links do begin Add(AxSwimLane1.Elements.item[TObject(1)],AxSwimLane1.Elements.item[TObject(2)],Nil); end; end
Delphi (standard)
with SwimLane1 do begin with Elements do begin Add('Element <sha ;;0>A',Null,Null); Add('Element <sha ;;0>B',OleVariant(96),OleVariant(24)); end; with Links do begin Add(SwimLane1.Elements.item[OleVariant(1)],SwimLane1.Elements.item[OleVariant(2)],Null); end; end
VFP
with thisform.SwimLane1 with .Elements .Add("Element <sha ;;0>A") .Add("Element <sha ;;0>B",96,24) endwith with .Links .Add(thisform.SwimLane1.Elements.item(1),thisform.SwimLane1.Elements.item(2)) endwith endwith
dBASE Plus
local oSwimLane,var_Elements,var_Links oSwimLane = form.Activex1.nativeObject var_Elements = oSwimLane.Elements var_Elements.Add("Element <sha ;;0>A") var_Elements.Add("Element <sha ;;0>B",96,24) var_Links = oSwimLane.Links var_Links.Add(oSwimLane.Elements.item(1),oSwimLane.Elements.item(2))
XBasic (Alpha Five)
Dim oSwimLane as P Dim var_Elements as P Dim var_Links as P oSwimLane = topparent:CONTROL_ACTIVEX1.activex var_Elements = oSwimLane.Elements var_Elements.Add("Element <sha ;;0>A") var_Elements.Add("Element <sha ;;0>B",96,24) var_Links = oSwimLane.Links var_Links.Add(oSwimLane.Elements.item(1),oSwimLane.Elements.item(2))
Visual Objects
local var_Elements as IElements local var_Links as ILinks var_Elements := oDCOCX_Exontrol1:Elements var_Elements:Add("Element <sha ;;0>A",nil,nil) var_Elements:Add("Element <sha ;;0>B",96,24) var_Links := oDCOCX_Exontrol1:Links var_Links:Add(oDCOCX_Exontrol1:Elements:[item,1],oDCOCX_Exontrol1:Elements:[item,2],nil)
PowerBuilder
OleObject oSwimLane,var_Elements,var_Links oSwimLane = ole_1.Object var_Elements = oSwimLane.Elements var_Elements.Add("Element <sha ;;0>A") var_Elements.Add("Element <sha ;;0>B",96,24) var_Links = oSwimLane.Links var_Links.Add(oSwimLane.Elements.item(1),oSwimLane.Elements.item(2))
Visual DataFlex
Procedure OnCreate
Forward Send OnCreate
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 <sha ;;0>A" Nothing Nothing to Nothing
Get ComAdd of hoElements "Element <sha ;;0>B" 96 24 to Nothing
Send Destroy to hoElements
Variant voLinks
Get ComLinks to voLinks
Handle hoLinks
Get Create (RefClass(cComLinks)) to hoLinks
Set pvComObject of hoLinks to voLinks
Variant vFrom
Variant voElements1
Get ComElements to voElements1
Handle hoElements1
Get Create (RefClass(cComElements)) to hoElements1
Set pvComObject of hoElements1 to voElements1
Get Comitem of hoElements1 1 to vFrom
Send Destroy to hoElements1
Variant vTo
Variant voElements2
Get ComElements to voElements2
Handle hoElements2
Get Create (RefClass(cComElements)) to hoElements2
Set pvComObject of hoElements2 to voElements2
Get Comitem of hoElements2 2 to vTo
Send Destroy to hoElements2
Get ComAdd of hoLinks vFrom vTo Nothing to Nothing
Send Destroy to hoLinks
End_Procedure
XBase++
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oElements LOCAL oLinks 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} ) oElements := oSwimLane:Elements() oElements:Add("Element <sha ;;0>A") oElements:Add("Element <sha ;;0>B",96,24) oLinks := oSwimLane:Links() oLinks:Add(oSwimLane:Elements:item(1),oSwimLane:Elements:item(2)) oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN