CPIndex: Integer;
CPIndex: Integer;
The CPIndex property returns the index of the connection point that should be moved.
Lines have two points: start point with the 0 index and the end point with the 1 index.
Executing the example requires a form with a button named Button1, the UiEtlObject component named UiEtlObject1 and the EtlBox component named EtlBox1. UiEtlObject1 is selected as a data source for EtlBox1. Any ETL task is connected to UiEtlObject1. The handler of the OnCreate event is created for the form, the handlers of the OnBeforeMoveCP and OnAfterMoveCPfor events are created for the EtlBox1 component. Add a link to the Andy system assembly.
Class SAMPLEForm: Form
UiEtlObject1: UiEtlObject;
EtlBox1: EtlBox;
Sub SAMPLEFormOnCreate(Sender: Object; Args: IEventArgs);
Begin
EtlBox1.ActiveTool := WxTool.Pointer;
End Sub SAMPLEFormOnCreate;
Sub EtlBox1OnBeforeMoveCP(Sender: Object; Args: IEtlMoveCPEventArgs);
Begin
If Args.CPIndex = 0 Then
Args.Cancel := True
End If;
Debug.WriteLine("Shape: " + Args.Shape.Id);
End Sub EtlBox1OnBeforeMoveCP;
Sub EtlBox1OnAfterMoveCP(Sender: Object; Args: IEtlAttachCPEventArgs);
Begin
Debug.WriteLine("Shape: " + Args.ShapeToAttach.Id + ". End point: " + Args.CPIndexToAttach.ToString);
End Sub EtlBox1OnAfterMoveCP;
End Class SAMPLEForm;
On starting the form for the EtlBox1 component, the pointer mode is activated where object bindings can be modified. If it is attempted to move the point with the 0 index (that is, the start point), the moving will be forbidden. Identifiers of shapes and shape point, with which the link is created, will be displayed in the development console.
See also: