HitTest Method
Description
Tests a location on the graph and returns the flow element at that location, if any.
Syntax
Public Function HitTest( _
ByVal [x](#) As Long, _
ByVal [y](#) As Long _
) As [FlowGraphElement](XtremeFlowGraph~FlowGraphElement.md)
Parameters
- x: X coordinate to test.
- y: Y coordinate to test.
Return Type
Returns a FlowGraphElement at the specified test position.
Remarks
All objects (nodes, etc.) are derived from FlowGraphElement, so you can cast the returned FlowGraphElement to the type of object you are looking for.
Example
Some sample code showing HitTest being used to test a point looking for Nodes:
Private Sub FlowGraph_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
Dim pNode As FlowGraphNode
Set pNode = FlowGraph.HitTest(x, y)
If Not pNode Is Nothing Then
Dim pPageTo As FlowGraphPage
Dim pNodeFrom As FlowGraphNode
Dim pNodeTo As FlowGraphNode
If (pNode.Id = ID_NODE_DATABASE1 And FlowGraph.ActivePage.Id = ID_PAGE_DATABASE) Then
Set pPageTo = FlowGraph.Pages.FindPage(ID_PAGE_TABLE1)
Set pNodeFrom = pNode
Set pNodeTo = pPageTo.Nodes.FindNode(ID_NODE_DATABASE1)
FlowGraph.History.AnimatePageTransition pNodeFrom, pNodeTo
UpdateButtons
End If
If (pNode.Id = ID_NODE_DATABASE2 And FlowGraph.ActivePage.Id = ID_PAGE_DATABASE) Then
Set pPageTo = FlowGraph.Pages.FindPage(ID_PAGE_TABLE2)
Set pNodeFrom = pNode
Set pNodeTo = pPageTo.Nodes.FindNode(ID_NODE_DATABASE2)
FlowGraph.History.AnimatePageTransition pNodeFrom, pNodeTo
UpdateButtons
End If
End If
End Sub
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.