IWxShape.ConnectedCPs

Syntax

ConnectedCPs(ConnectionPointIndex: Integer; ConnectedCPShapeIndex: Integer): Integer;

ConnectedCPs[ConnectionPointIndex: integer; ConnectedCPShapeIndex: integer]: integer;

Parameters

ConnectionPointIndex. Index of source object connection point (shown as a red point on the image).

ConnectedCPShapeIndex. Index of the shape linked to the object in ConnectionPointIndex (the figure shows two such shapes: A and B).

Description

The ConnectedCP property returns an index for a connection point of a shape connected with the source object in the defined point.

ConnectionPointIndex (connection point) is displayed in red. There are two shapes, connected with the object in this point: A and B. The property will return index 0 for both shapes.

Indexes of the original object connection points are displayed in black.

Connection point indexes of shapes, connected with an object in the ConnectionPointIndex point, are displayed in blue and green.

Example

Executing the example requires that repository contains a workspace with the WSP identifier containing several connected shapes.

Add links to the Andy, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    ws: IWxWorkspace;
    i, j, ISh: Integer;
    Shape: IWxShape;
Begin
    MB := MetabaseClass.Active;
    
// Get workspace
    ws := MB.ItemById("WSP").Edit As IWxWorkspace;
    Shape := ws.Shapes.Item(
0);
    
For i := 0 To Shape.ConnectionPointsCount - 1 Do
        
If Shape.ConnectedCpShapesCount(i) > 0 Then
            
For j := 0 To Shape.ConnectedCpShapesCount(i) - 1 Do
                ISh := Shape.ConnectedCPs(i, j);
                Debug.WriteLine(
"Connection point index " + ISh.ToString + " for object with ConnectedCPShapeIndex = " + j.ToString);
            
End For;
        
End If;
    
End For;
    
// Save changes
    (ws As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Andy;
 
Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    ws: IWxWorkspace;
    i, j, ISh: Integer;
    Shape: IWxShape;
    WinAppCls: WinApplicationClass = 
New WinApplicationClassClass();
    
//WinApp: WinApplication = New WinApplicationClass_2();
Begin
    MB := Params.Metabase;
    
// Get workspace
    ws := MB.ItemById["WSP"].Edit() As IWxWorkspace;
    Shape := ws.Shapes.Item[
0];
    
For i := 0 To Shape.ConnectionPointsCount - 1 Do
        
If Shape.ConnectedCpShapesCount[i] > 0 Then
            
For j := 0 To Shape.ConnectedCpShapesCount[i] - 1 Do
                ISh := Shape.ConnectedCPs[i, j];
                System.Diagnostics.Debug.WriteLine(
"Connection point index " + ISh.ToString() + " for object with ConnectedCPShapeIndex = " + j.ToString());
            
End For;
        
End If;
    
End For;
    
// Save changes
    (ws As IMetabaseObject).Save();

When executing the example there will be several messages returned, containing a connection point index of a shape, connected with the original object in the ConnectionPointIndex point.

See also:

IWxShape