Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Multi Selection of nodes. (Read 8098 times)
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Multi Selection of nodes.
Apr 15th, 2010 at 9:23am
Print Post  
Hi,

Is it possible to select multiple nodes by clicking on each node without having the Ctrl key pressed.

Is there any property for that?

Please help.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #1 - Apr 15th, 2010 at 10:52am
Print Post  
Hi,

You could set e.Node.Selected in response to the NodeClicked event.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #2 - Apr 15th, 2010 at 11:07am
Print Post  
Hi Stoyan,
This will just select one node.

Assume we have 3 nodes in the diagram, i click on the first node, it gets selected, then if i click on the second node, i want the first node to mainitain its selection as well as the second node also to be selected. Something link pressing the Ctrl key and selecting.

Is it possible?
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #3 - Apr 15th, 2010 at 1:01pm
Print Post  
Also handle NodeSelecting and set e.Cancel = true to prevent the standard selection change. Then if you set e.Node.Selected from the Clicked event, this should only add to the selection.
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #4 - Apr 15th, 2010 at 1:13pm
Print Post  
Hi,

It doesn't help.

When i tried handling the NodeSelecting event and set e.Cancel = true, i am not even able to select a single node. Its cancelling all the selection.

  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #5 - Apr 15th, 2010 at 1:23pm
Print Post  
But you still have to set e.Node.Selected in response to the NodeClicked event. The Selected setter does not raise NodeSelecting and directly adds to the selection.
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #6 - Apr 15th, 2010 at 1:48pm
Print Post  
Yes i did both the things which you wanted me to do, but it doesn't select any node.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #7 - Apr 16th, 2010 at 8:01am
Print Post  
This works for me:

Code
Select All
private void OnNodeClicked(object sender, NodeEventArgs e)
{
	e.Node.Selected = true;
}

private void OnNodeSelecting(object sender, NodeValidationEventArgs e)
{
	e.Cancel = true;
} 



Some problems I can see with it are that you can't unselect nodes by clicking, and you can't select nodes using the selection rectangle. The following fixes these problems:

Code
Select All
private void OnNodeClicked(object sender, NodeEventArgs e)
{
	e.Node.Selected = !e.Node.Selected;
}

private void OnNodeSelecting(object sender, NodeValidationEventArgs e)
{
	if (e.SelectionRectangle.IsEmpty)
		e.Cancel = true;
} 



If you can't get it to work, post your diagram initialization code here. Some other event handlers or a specific Behavior type might make selection work differently.

Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #8 - Apr 16th, 2010 at 11:53am
Print Post  
It still didn't work. Sad

Here is my initialization code,

<d:Ruler x:Name="diagramRuler">
<d:Diagram x:Name="diagram"
Behavior="DrawLinks"
ShowAnchors="Auto"
AllowDrop="True"
AutoScroll="True"
AllowSelfLoops="False"
AllowLinksRepeat="False"
AutoResize="RightAndDown"
ShowGrid="True"
GridStyle="Points"
LinkHeadShape="Alternative"
LinkHeadShapeSize="8"
LinkBrush="Gray"
AlignToGrid="True"
HorizontalAlignment="Stretch"
/>
</d:Ruler>

I haven't set any property through code behind.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #9 - Apr 19th, 2010 at 9:01am
Print Post  
It works for me with these settings too. Do you have any event handlers other than NodeClicked and Selecting?
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #10 - May 4th, 2010 at 1:19pm
Print Post  
Yes, i handle lot of events, other than this.

They are,

diagram.Drop += new DragEventHandler(Diagram_Drop);
           diagram.NodeSelected += new NodeEventHandler(diagram_NodeSelected);
           diagram.NodeSelecting += new NodeValidationEventHandler(diagram_NodeSelecting);
           diagram.NodeDeleting += new NodeValidationEventHandler(diagram_NodeDeleting);
           diagram.NodeModifying += new NodeValidationEventHandler(diagram_NodeModifying);
           diagram.NodeModified += new NodeEventHandler(diagram_NodeModified);
           diagram.NodeClicked += new NodeEventHandler(diagram_NodeClicked);
           diagram.Clicked += new DiagramEventHandler(diagram_Clicked);
           diagram.CellClicked += new CellEventHandler(diagram_CellClicked);
           diagram.PreviewKeyDown += new KeyEventHandler(diagram_PreviewKeyDown);
           diagram.SelectionMoving += new ValidationEventHandler(diagram_SelectionMoving);
           diagram.LinkCreated += new LinkEventHandler(diagram_LinkCreated);
           diagram.LinkCreating += new LinkValidationEventHandler(diagram_LinkCreating);
           diagram.LinkClicked += new LinkEventHandler(diagram_LinkClicked);
           diagram.SizeChanged += new SizeChangedEventHandler(diagram_SizeChanged);
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #11 - May 4th, 2010 at 3:29pm
Print Post  
Please add the event handlers to a test project until the problem is reproduced and email the project to support@mindfusion.eu.

Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #12 - May 10th, 2010 at 4:57am
Print Post  
Hi Stoyan,

I have sent a sample project with all the diagram events handled. I am able to reproduce the problem. The sample project might be huge, i have created a region called "Diagram Events" inside Workflowstudio.xaml.cs for your easy reference.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Multi Selection of nodes.
Reply #13 - May 10th, 2010 at 10:14am
Print Post  
Hi,

How can I add new nodes in you app? From what I can see, multiple-selection by click works for the predefined start and stop nodes created from the constructor. You can't see the startNode handles because its HandlesStyle is set to Custom, but there's no DrawAdjustmentHandles handler to draw the custom handle visuals.

Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Multi Selection of nodes.
Reply #14 - May 10th, 2010 at 12:08pm
Print Post  
Hi,

Double click on the 7th and 8th Image from the left hand side tool box, that will create new nodes.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint