Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Selecting Link Programatically (Read 1444 times)
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Selecting Link Programatically
May 2nd, 2011 at 9:15pm
Print Post  
I am trying to select a link when a node is clicked on. I thought this would be pretty straight forward by adding the link to the selection collection of the diagram but for some reason the link does not show up selected after the node clicked handler runs. We are using a custom link object but there is nothing in it that has to do with selection. Here is the code which is part of the NodeClicked handler. Any help would be appreciated.

Code
Select All
                else if (selectedShapeNode.Tag is RouteLinkTag)
                {
                    int id = ((RouteLinkTag) selectedShapeNode.Tag).ID;
                    foreach (CustomDiagramLink link in currentDiagram.Links)
                    {
                        RouteLinkTag tag = (RouteLinkTag) link.Tag;
                        if (tag.ID == id)
                        {
                            link.Selected = true;
                            currentDiagram.Selection.Items.Add(link);
                            currentDiagram.ActiveItem = link;
                            break;
                        }
                    }
                }

 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Selecting Link Programatically
Reply #1 - May 3rd, 2011 at 6:15am
Print Post  
It seems this event is raised just before the diagram selects the clicked node, which also removes any other items from the selection. Try selecting links from the NodeActivated handler.

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