Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to get the focused node id (Read 1466 times)
deepak
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Jun 29th, 2011
How to get the focused node id
Jul 19th, 2011 at 11:48am
Print Post  
Hello Stoyo

I want to get the node id. I write the following code

private void diagramView1_Click(object sender, EventArgs e)
{
  try
  {
     diagramView1.Focus();
     DiagramView sn = (DiagramView)sender;

     var selectedShapeNode = sn.Diagram.ActiveItem as ShapeNode;

     if (selectedShapeNode != null)
     {
       int id = (int)selectedShapeNode.id;
       MessageBox.Show("id = " + id);
     }
  }
  catch
  {
  }
}

When I click on node first time it set null or wrong id. On Second time time click on same node that it gives correct id. I want to get id on single click.
One more think I got the id which is drag from treelist.I want to get the id which is I store in database for a particular node.
As per privious diagram (http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=131079995...)
I have added more than one item in single node(many times drag items are repeatedly add in digramview node).When I select one node(two nodes fill same items from treelist) that time I got same id. That’s why I want to set the id for perticular node. In this node I set multiple items at a time. When I click the node I want to get that node id not a drag item id.


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to get the focused node id
Reply #1 - Jul 19th, 2011 at 1:36pm
Print Post  
Hi,

Id is never set automatically by the diagram; that's probably done from some event handler by your code. So make sure the Id value is set in the earliest moment possible, e.g. in NodeCreated for nodes drawn by user, or immediately after calling Factory methods for nodes created programmatically.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint