The
diagConnectionPoint type is used to define all the advanced characteristics of a connection point (i.e. point around a shape that a connector snaps to) in a Diagram Editor control. The characteristics of this connection point can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
N is int
// Create a rectangle shape
MyShape1 is diagRectangle
// Set the dimensions, position and background color
MyShape1.X = 100
MyShape1.Y = 100
MyShape1.Width = 50
MyShape1.Height = 50
MyShape1.Background.Color = PastelRed
// Reference the displayed diagram
MyDiagram is Diagram <- DIAGEDT_MyDiagram
// Add the rectangle shape to the diagram
N = Add(MyDiagram.Shape, MyShape1)
// Create an ellipse
MyShape2 is diagOval
// Set the dimensions, position and background color
MyShape2.X = 200
MyShape2.Y = 200
MyShape2.Width = 50
MyShape2.Height = 50
MyShape2.Background.Color = PastelGreen
// Add the ellipse to the diagram
Add(MyDiagram.Shape, MyShape2)
// Creates a connector
MyConnector is diagConnector
Add(MyDiagram.Shape, MyConnector)
// Reference added objects
MyShape1 <- MyDiagram.Shape[ N ]
MyShape2 <- MyDiagram.Shape[ N + 1 ]
MyConnector <- MyDiagram.Shape[ N + 2 ]
MyConnector.Beginning.ConnectionPoint = MyShape1.ConnectionPoint[1]
MyConnector.Beginning.ConnectionPoint.X = 100
MyConnector.Beginning.ConnectionPoint.Y = 50
MyConnector.Ending.ConnectionPoint = MyShape2.ConnectionPoint[1]
MyConnector.Ending.ConnectionPoint.X = 0
MyConnector.Ending.ConnectionPoint.Y = 50
Properties
Properties specific to diagConnectionPoint variables
The following properties can be used to handle a connection point:
| | |
Property name | Type used | Effect |
---|
Shape | diagShape | Shape that contains the connection point. |
X | Real | X-coordinate of the connection point, expressed in pixels. |
XPercent | Real | X-coordinate of the connection point, expressed as a percentage. |
Y | Real | Y-coordinate of the connection point, expressed in pixels. |
YPercent | Real | Y-coordinate of the connection point, expressed as a percentage. |
Remarks
- Connectors can always snap to connection points created programmatically.
- Multiple connectors can start from or end at a given connection point.
- Shapes can have multiple connection points, accessible via the ConnectionPoint array of variables of type diagShape.
- Both ends of a connector can have a connection point.