We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

diagram.view.selectionlist is giving first last as threw some exception

I was trying to get the selection list of nodes from diagram on mouseclick on that node.
First click on node gave me the selection list with nodes.But when I clicked again on the node it gave me Argument out of range exception exception like....
"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index". Screenshot attached
Why this selection list works only once?Can anyone pls help me?

/Sebastain



1_9357a7f1.zip

8 Replies

AD Administrator Syncfusion Team December 8, 2008 03:27 AM UTC

Hi Aida,

In the method, just type the following "IF condition clause":

NodeCollection nd = this.diagram1.View.SelectionList;
if(!nd.IsEmpty)
if (nd.First is Node)
{
MessageBox.Show("Test");
}

Let me know if you need any further clarification in this regard, Thanks!

Happy coding!

- Ajeet




AD Administrator Syncfusion Team December 8, 2008 11:28 AM UTC

Hello ajeet,
This didn't solve my problem.I need the node selection.so that If it is a node i need to take some action.
I tried with "this.diagram1.View.SelectionList" and also this.diagram1.Controller.NodesHit I am getting nothing in selection.How can I get the selected node in selection?



>Hi Aida,

In the method, just type the following "IF condition clause":

NodeCollection nd = this.diagram1.View.SelectionList;
if(!nd.IsEmpty)
if (nd.First is Node)
{
MessageBox.Show("Test");
}

Let me know if you need any further clarification in this regard, Thanks!

Happy coding!

- Ajeet






AD Administrator Syncfusion Team December 8, 2008 12:19 PM UTC

Hello ajeet,
This didn't solve my problem.I need the node selection list with selected nodes so that If it is a node I need to take some action.
I tried with "this.diagram1.View.SelectionList" and also "this.diagram1.Controller.NodesHit".Both the cases I am getting nothing in selection.How can I get the selected node in selection?



AD Administrator Syncfusion Team December 9, 2008 04:46 AM UTC

Hi Aida,

The SelectionList has an entry for the selected node only if the "Node" is selected (as after we click on it, to get it focus).

In you code, you didn't give a condition check for whether the Selection List is "empty" or not!

If the Node is selected, then that Node and its information can be accessed using:

"this.diagram1.Controller.SelectionList.First"

Let me know if you need further clarifications in this regard, Thanks!

Happy coding!

- Ajeet





>Hello ajeet,
This didn't solve my problem.I need the node selection list with selected nodes so that If it is a node I need to take some action.
I tried with "this.diagram1.View.SelectionList" and also "this.diagram1.Controller.NodesHit".Both the cases I am getting nothing in selection.How can I get the selected node in selection?





AD Administrator Syncfusion Team December 9, 2008 05:23 AM UTC

Hello Ajeet,
I put the condition clause as you said.Then it just skip if the selectionlist is empty..But my question is Why I am not getting the selection list.Why the
selectionlist is empty evenif I click on a node.Its ok to be empty if I click in free area.But selection list should contain the code if I click over a node.
Also to your attention ,first time it's giving the selectionlist with node evenif I not click on a node.Second click onward even that's not happening.Why this anomalies.

what are all the properties I need to set for Diagram and Node etc to get my selectionlist proper.Pls assist me as soon as possible.

>Hi Aida,

The SelectionList has an entry for the selected node only if the "Node" is selected (as after we click on it, to get it focus).

In you code, you didn't give a condition check for whether the Selection List is "empty" or not!

If the Node is selected, then that Node and its information can be accessed using:

"this.diagram1.Controller.SelectionList.First"

Let me know if you need further clarifications in this regard, Thanks!

Happy coding!

- Ajeet





>Hello ajeet,
This didn't solve my problem.I need the node selection list with selected nodes so that If it is a node I need to take some action.
I tried with "this.diagram1.View.SelectionList" and also "this.diagram1.Controller.NodesHit".Both the cases I am getting nothing in selection.How can I get the selected node in selection?







AD Administrator Syncfusion Team December 9, 2008 06:00 AM UTC

Hi Aida,

I am afraid but I am not able to face any such issues. Also, I would be glad if you could send us the sample file for testing, so that we can provide with you the solution at the earliest.

Thanks and Regards,
Ajeet





AD Administrator Syncfusion Team December 9, 2008 06:33 AM UTC

Hello Ajeet,
OK.I will send the code.
I have one more Query.I have a node(a curvenode).It's created and appended to model.Now how can I add some points to extend the node? I mean without redrawing it again I need to extend the same node from last point,The curve just get resized from end point.
Can you please send me some sample code for the same as soon as possible


>Hi Aida,

I am afraid but I am not able to face any such issues. Also, I would be glad if you could send us the sample file for testing, so that we can provide with you the solution at the earliest.

Thanks and Regards,
Ajeet







AD Administrator Syncfusion Team December 9, 2008 06:37 AM UTC

Hi Aida,

I shall be waiting for your code.

Also, in reference to your another query, I would suggest you to open that issue in a new Forum Tag, so that response could be given more clearly and that will also help us in tracking the issues more clearly.

Thanks and Regards,
Ajeet



Loader.
Live Chat Icon For mobile
Up arrow icon