Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Linking Tablenode rows (Read 4241 times)
turtlebase
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 6th, 2011
Linking Tablenode rows
Sep 7th, 2014 at 5:22pm
Print Post  
Using 5.4
How do I Programmatically create a link between two (2) specific tablenode rows. I have setup a group of tables each with multiple rows and 2 columns. The rows in the left column are for incoming links where each row has a specific ID. the rows in the right-hand columns are for outgoing links - again each having a unique ID. I am trying to Programmatically
draw the links between the tablenodes where the outgoing table row ID matching the incoming tablenode row ID on the other tables. I have tried using the anchor point's (who's Tag's match the respective rows ID) but that is only relative to the rows anchor pattern.

when I try Diagram1.Factory.CreateDiagramLink(Diagram1.Nodes(oIndex), oAPIndex, Diagram1.Nodes(dIndex), iAPIndex)
it fails
however if I omit the first integer in the originating table node it works i.e. this works:
Diagram1.Factory.CreateDiagramLink(Diagram1.Nodes(oIndex), Diagram1.Nodes(dIndex), iAPIndex)



So my problem is how to link specific tablrnode rows Programmatically with both rows


Thank you!

« Last Edit: Sep 7th, 2014 at 10:48pm by turtlebase »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Linking Tablenode rows
Reply #1 - Sep 8th, 2014 at 5:23am
Print Post  
Try using the following overloaded method, first casting the nodes to TableNode:

Code
Select All
public DiagramLink CreateDiagramLink (
    TableNode origin,
    int originRow,
    TableNode destination,
    int destRow
)

var table1 = (TableNode)diagram.Nodes[oIndex];
var table2 = (TableNode)diagram.Nodes[dIndex];
diagram.Factory.CreateDiagramLink(table1, rowIndex1, table2, rowIndex2); 



Alternatively, you could set the link's OriginIndex and DestinationIndex properties after creating it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
turtlebase
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 6th, 2011
Re: Linking Tablenode rows
Reply #2 - Sep 8th, 2014 at 7:18pm
Print Post  
Thank you

Do you know why the call won't compile when formatted as

Diagram1.Factory.CreateDiagramLink(Diagram1.Nodes(oIndex), oAPIndex, Diagram1.Nodes(dIndex), iAPIndex)

it errors with:

Error      9      Overload resolution failed because no accessible 'CreateDiagramLink' can be called without a narrowing conversion:
    'Public Function CreateDiagramLink(origin As MindFusion.Diagramming.TableNode, originRow As Integer, destination As MindFusion.Diagramming.TableNode, destRow As Integer) As MindFusion.Diagramming.DiagramLink': Argument matching parameter 'origin' narrows from 'MindFusion.Diagramming.DiagramNode' to 'MindFusion.Diagramming.TableNode'.
    'Public Function CreateDiagramLink(origin As MindFusion.Diagramming.TableNode, originRow As Integer, destination As MindFusion.Diagramming.TableNode, destRow As Integer) As MindFusion.Diagramming.DiagramLink': Argument matching parameter 'destination' narrows from 'MindFusion.Diagramming.DiagramNode' to 'MindFusion.Diagramming.TableNode'.
    'Public Function CreateDiagramLink(origin As MindFusion.Diagramming.ShapeNode, originAnchor As Integer, destination As MindFusion.Diagramming.ShapeNode, destAnchor As Integer) As MindFusion.Diagramming.DiagramLink': Argument matching parameter 'origin' narrows from 'MindFusion.Diagramming.DiagramNode' to 'MindFusion.Diagramming.ShapeNode'.
    'Public Function CreateDiagramLink(origin As MindFusion.Diagramming.ShapeNode, originAnchor As Integer, destination As MindFusion.Diagramming.ShapeNode, destAnchor As Integer) As MindFusion.Diagramming.DiagramLink': Argument matching parameter 'destination' narrows from 'MindFusion.Diagramming.DiagramNode' to 'MindFusion.Diagramming.ShapeNode'.      C:\Projects\WESTEMS_Monitoring\westems\westems\IM_Model_DesignS.vb      1289      33      WESTEMS

But will compile when formatted as:

Diagram1.Factory.CreateDiagramLink(Diagram1.Nodes(oIndex), Diagram1.Nodes(dIndex), iAPIndex)

Again Thank you!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Linking Tablenode rows
Reply #3 - Sep 9th, 2014 at 6:40am
Print Post  
I suppose VB cannot choose between the (TableNode, int, ...) and (ShapeNode, int, ...) overloads, so you will need to typecast the nodes explicitly using CType function. There is a single overload whose signature matches the second example, and the compiler can typecast the arguments implicitly in that case.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
turtlebase
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Apr 6th, 2011
Re: Linking Tablenode rows
Reply #4 - Sep 9th, 2014 at 3:39pm
Print Post  
Thank you Stoyan - it does work when I cast the diagramnode into a tablenode.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint