Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Preventing items from being dropped into a container (Read 2262 times)
matt.s
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Apr 3rd, 2008
Preventing items from being dropped into a container
Feb 27th, 2012 at 10:53am
Print Post  
Hi,

I'd like to control and restrict which nodes can be placed inside a container.

I can see the ContainerChildAdded event, but there does not appear to be a Cancel property on the EventArgs which would allow me to prevent a certain operation from happening.

Is this possible to do?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Preventing items from being dropped into a container
Reply #1 - Feb 27th, 2012 at 2:56pm
Print Post  
Hi,

There's no validation event available yet for this. You could use NodeModifying instead:

Code
Select All
private void OnNodeModifying(object sender, NodeValidationEventArgs e)
{
	var mousePos = Mouse.GetPosition(diagram.DocumentPlane);
	var ctr = diagram.GetNodeAt(mousePos, true, true) as ContainerNode;
	if (ctr != null /* and e.Node should not be hosted in container */)
		e.Cancel = true;
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
matt.s
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Apr 3rd, 2008
Re: Preventing items from being dropped into a container
Reply #2 - Feb 27th, 2012 at 3:15pm
Print Post  
Hi Stoyan,

Yes this works. Once again, thanks for the quick reply.

Matt
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint