AddConnection Method
Description
Adds a connection to the Node.
Syntax
Public Function AddConnection() As [FlowGraphConnection](XtremeFlowGraph~FlowGraphConnection.md)
Return Type
Returns a reference to the connection that was just added.
Example
Adds nodes, connection points, and connections to a Flow Graph.
Dim Page As FlowGraphPage
Set Page = FlowGraph.Pages.AddPage
Page.ZoomLevel = 1
Debug.Print FlowGraph.Pages.Count
Set FlowGraph.ActivePage = Page
' Customers
Dim pTableCustomers As FlowGraphNode
Set pTableCustomers = Page.Nodes.AddNode
pTableCustomers.Caption = "Customers"
pTableCustomers.Tooltip = "Customers Table"
pTableCustomers.Color = RGB(155, 187, 89)
pTableCustomers.LocationX = 620
pTableCustomers.LocationY = 360
pTableCustomers.ImageIndex = 0
pTableCustomers.AddNamedConnectionPoints "ID", xtpFlowGraphPointInput
pTableCustomers.AddNamedConnectionPoints "Company", xtpFlowGraphPointNone
pTableCustomers.AddNamedConnectionPoints "Last Name", xtpFlowGraphPointNone
pTableCustomers.AddNamedConnectionPoints "First Name", xtpFlowGraphPointNone
pTableCustomers.AddNamedConnectionPoints "Job Title", xtpFlowGraphPointNone
pTableCustomers.AddNamedConnectionPoints "Business Phone", xtpFlowGraphPointNone
' Orders
Dim pTableOrders As FlowGraphNode
Set pTableOrders = Page.Nodes.AddNode
pTableOrders.Caption = "Orders"
pTableOrders.Tooltip = "Orders Table"
pTableOrders.LocationX = 220
pTableOrders.LocationY = 90
'pTableOrders.Color = RGB(192, 80, 77)
pTableOrders.AddNamedConnectionPoints "Order ID", xtpFlowGraphPointInput
pTableOrders.AddNamedConnectionPoints "Employee ID", xtpFlowGraphPointOutput
pTableOrders.AddNamedConnectionPoints "Customer ID", xtpFlowGraphPointOutput
pTableOrders.AddNamedConnectionPoints "Order Date", xtpFlowGraphPointNone
pTableOrders.AddNamedConnectionPoints "Shipped Date", xtpFlowGraphPointNone
pTableOrders.AddNamedConnectionPoints "Shipper ID", xtpFlowGraphPointOutput
pTableOrders.AddNamedConnectionPoints "Taxes", xtpFlowGraphPointNone
pTableOrders.AddNamedConnectionPoints "Payment Type", xtpFlowGraphPointNone
pTableOrders.AddNamedConnectionPoints "Paid Date", xtpFlowGraphPointNone
pTableOrders.AddNamedConnectionPoints "Notes", xtpFlowGraphPointNone
' Employees
Dim pTableEmployees As FlowGraphNode
Set pTableEmployees = Page.Nodes.AddNode
pTableEmployees.Caption = "Employees"
pTableEmployees.Tooltip = "Employees Table"
pTableEmployees.LocationX = 620
pTableEmployees.LocationY = 90
pTableEmployees.Color = RGB(75, 172, 198)
pTableEmployees.AddNamedConnectionPoints "ID", xtpFlowGraphPointInput
pTableEmployees.AddNamedConnectionPoints "Company", xtpFlowGraphPointNone
pTableEmployees.AddNamedConnectionPoints "Last Name", xtpFlowGraphPointNone
pTableEmployees.AddNamedConnectionPoints "First Name", xtpFlowGraphPointNone
pTableEmployees.AddNamedConnectionPoints "E-mail Address", xtpFlowGraphPointNone
pTableEmployees.AddNamedConnectionPoints "Job Title", xtpFlowGraphPointNone
pTableEmployees.AddNamedConnectionPoints "Business Phone", xtpFlowGraphPointNone
' Order Details
Dim pTableOrderDetails As FlowGraphNode
Set pTableOrderDetails = Page.Nodes.AddNode
pTableOrderDetails.Caption = "Order Details"
pTableOrderDetails.Tooltip = "Order Details Table"
pTableOrderDetails.LocationX = 20
pTableOrderDetails.LocationY = 200
pTableOrderDetails.Color = RGB(192, 80, 77)
pTableOrderDetails.ImageIndex = 1
pTableOrderDetails.AddNamedConnectionPoints "ID", xtpFlowGraphPointInput
pTableOrderDetails.AddNamedConnectionPoints "Order ID", xtpFlowGraphPointOutput
pTableOrderDetails.AddNamedConnectionPoints "Product ID", xtpFlowGraphPointOutput
pTableOrderDetails.AddNamedConnectionPoints "Quantity", xtpFlowGraphPointNone
pTableOrderDetails.AddNamedConnectionPoints "Unit Price", xtpFlowGraphPointNone
pTableOrderDetails.AddNamedConnectionPoints "Discount", xtpFlowGraphPointNone
pTableOrderDetails.AddNamedConnectionPoints "Status ID", xtpFlowGraphPointNone
' Shippers
Dim pTableShippers As FlowGraphNode
Set pTableShippers = Page.Nodes.AddNode
pTableShippers.Caption = "Shippers"
pTableShippers.Tooltip = "Shippers Table"
pTableShippers.LocationX = 420
pTableShippers.LocationY = 360
'pTableShippers.Color = RGB(128, 100, 162)
pTableShippers.AddNamedConnectionPoints "ID", xtpFlowGraphPointInput
pTableShippers.AddNamedConnectionPoints "Company", xtpFlowGraphPointNone
pTableShippers.AddNamedConnectionPoints "Last Name", xtpFlowGraphPointNone
pTableShippers.AddNamedConnectionPoints "First Name", xtpFlowGraphPointNone
pTableShippers.AddNamedConnectionPoints "E-mail Address", xtpFlowGraphPointNone
pTableShippers.AddNamedConnectionPoints "Job Title", xtpFlowGraphPointNone
pTableShippers.AddNamedConnectionPoints "Business Phone", xtpFlowGraphPointNone
' Products
Dim pTableProducts As FlowGraphNode
Set pTableProducts = Page.Nodes.AddNode
pTableProducts.Caption = "Products"
pTableProducts.Tooltip = "Products Table"
pTableProducts.LocationX = 270
pTableProducts.LocationY = 360
'pTableProducts.Color = RGB(75, 172, 198)
pTableProducts.AddNamedConnectionPoints "ID", xtpFlowGraphPointInput
pTableProducts.AddNamedConnectionPoints "Product Code", xtpFlowGraphPointNone
pTableProducts.AddNamedConnectionPoints "Product Name", xtpFlowGraphPointNone
pTableProducts.AddNamedConnectionPoints "Description", xtpFlowGraphPointNone
pTableProducts.AddNamedConnectionPoints "Price", xtpFlowGraphPointNone
pTableProducts.AddNamedConnectionPoints "Category", xtpFlowGraphPointNone
' Manage connections
Dim pConnection As FlowGraphConnection
Set pConnection = Page.Connections.AddConnection
pConnection.OutputPoint = pTableOrders.ConnectionPoints.FindConnectionPointByCaption("Customer ID")
pConnection.InputPoint = pTableCustomers.ConnectionPoints.FindConnectionPointByCaption("ID")
pConnection.Caption = "Customer relation"
pConnection.Style = xtpFlowGraphConnectorCurvedDoubleArrow
Set pConnection = Page.Connections.AddConnection
pConnection.OutputPoint = pTableOrders.ConnectionPoints.FindConnectionPointByCaption("Shipper ID")
pConnection.InputPoint = pTableShippers.ConnectionPoints.FindConnectionPointByCaption("ID")
Set pConnection = Page.Connections.AddConnection
pConnection.OutputPoint = pTableOrders.ConnectionPoints.FindConnectionPointByCaption("Employee ID")
pConnection.InputPoint = pTableEmployees.ConnectionPoints.FindConnectionPointByCaption("ID")
pConnection.Style = xtpFlowGraphConnectorElbowArrow
Set pConnection = Page.Connections.AddConnection
pConnection.OutputPoint = pTableOrderDetails.ConnectionPoints.FindConnectionPointByCaption("Order ID")
pConnection.InputPoint = pTableOrders.ConnectionPoints.FindConnectionPointByCaption("Order ID")
Set pConnection = Page.Connections.AddConnection
pConnection.OutputPoint = pTableOrderDetails.ConnectionPoints.FindConnectionPointByCaption("Product ID")
pConnection.InputPoint = pTableProducts.ConnectionPoints.FindConnectionPointByCaption("ID")
See Also
FlowGraphConnections Collection
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.