event CreateElement (Element as Element)
The user creates at runtime a new element.

TypeDescription
Element as Element An Element object being created.
The CreateElement event occurs when the user creates the element on the surface. The AllowCreateElement property specifies the keys combination to let the user creates the elements at runtime. Prior to CreateElement event the AddElement event is fired to notify that the element has been added to the Elements collection. The CreateElement event is not fired when you add programmatically the element calling the Add method. For instance, you can call the Element.Edit method during the CreateElement to let the user edits the element's caption once a new element is created. You can call the Remove method to remove the newly created element.

The order of the events when the user creates the element at runtime is:

The CreateElement event is not called during the LoadXML method.

Syntax for CreateElement event, /NET version, on:

private void CreateElement(object sender,exontrol.EXSWIMLANELib.Element Element)
{
}

Private Sub CreateElement(ByVal sender As System.Object,ByVal Element As exontrol.EXSWIMLANELib.Element) Handles CreateElement
End Sub

Syntax for CreateElement event, /COM version, on:

private void CreateElement(object sender, AxEXSWIMLANELib._ISwimLaneEvents_CreateElementEvent e)
{
}

void OnCreateElement(LPDISPATCH Element)
{
}

void __fastcall CreateElement(TObject *Sender,Exswimlanelib_tlb::IElement *Element)
{
}

procedure CreateElement(ASender: TObject; Element : IElement);
begin
end;

procedure CreateElement(sender: System.Object; e: AxEXSWIMLANELib._ISwimLaneEvents_CreateElementEvent);
begin
end;

begin event CreateElement(oleobject Element)
end event CreateElement

Private Sub CreateElement(ByVal sender As System.Object, ByVal e As AxEXSWIMLANELib._ISwimLaneEvents_CreateElementEvent) Handles CreateElement
End Sub

Private Sub CreateElement(ByVal Element As EXSWIMLANELibCtl.IElement)
End Sub

Private Sub CreateElement(ByVal Element As Object)
End Sub

LPARAMETERS Element

PROCEDURE OnCreateElement(oSwimLane,Element)
RETURN

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

<SCRIPT EVENT="CreateElement(Element)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function CreateElement(Element)
End Function
</SCRIPT>

Procedure OnComCreateElement Variant llElement
	Forward Send OnComCreateElement llElement
End_Procedure

METHOD OCX_CreateElement(Element) CLASS MainDialog
RETURN NIL

void onEvent_CreateElement(COM _Element)
{
}

function CreateElement as v (Element as OLE::Exontrol.SwimLane.1::IElement)
end function

function nativeObject_CreateElement(Element)
return

The following VB sample calls the Edit method once a new element is created:

Private Sub SwimLane1_CreateElement(ByVal Element As EXSWIMLANELibCtl.IElement)
    With Element
        .AutoSize = True
        .Caption = "new " & SwimLane1.Elements.Count
        .Edit exEditCaption
    End With
End Sub

The following VB sample creates an element that hosts the Exontrol.Button control:

Private Sub SwimLane1_CreateElement(ByVal Element As EXSWIMLANELibCtl.IElement)
    With Element
        .Type = exElementHostControl
        .ElementFormat = """client"""
        .Control = "Exontrol.Button"
        With .Object
            .Caption = "<sha ;;0>Button " & SwimLane1.Elements.Count
        End With
    End With
End Sub