I’m sure I’m missing something obvious here, but I am trying to create the functionality of double clicking an object on the palette and having it create the node on the canvas, and if a node already exists on the canvas, to connect them.
I have it working, but to get it to draw the nodes, I have to single click on the canvas. I even found some code you provided in another thread and it works great, except, to get it the nodes to appear, I have to single click the canvas.
I built my code on the FlowCharter sample. I’m wondering if I’m not missing a single click event or something. I did remove the background single click event handler that the sample had, but maybe I didn’t remove it enough?
Here’s the code i found…
// create two nodes for fun…
GoBasicNode node1 = new GoBasicNode();
// specify label, appearance, and position
node1.LabelSpot = GoObject.Middle;
node1.Text = “first”;
node1.Brush = Brushes.Blue;
node1.Location = new PointF(100, 100);
// add to the document, not to the view
GoBasicNode node2 = new GoBasicNode();
node2.LabelSpot = GoObject.Middle;
node2.Text = “second”;
node2.Brush = Brushes.Magenta;
node2.Location = new PointF(200, 100);
// create a link between the two nodes’ ports
GoLink link = new GoLink();
link.ToArrow = true;
link.FromPort = node1.Port;
link.ToPort = node2.Port;