Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Prevent from adding node to diagram (Read 1409 times)
MUDO
Junior Member
**
Offline



Posts: 90
Joined: Nov 29th, 2008
Prevent from adding node to diagram
May 20th, 2009 at 7:28pm
Print Post  
Hi.

I add nodes to diagram via
- code (diagram.add)
- drag&drop (from toolbar)
- interactive (InteractionState value from my derived CustomBehavior class)

Before adding I check my conditions (dataset,...) and then I decide to not/add node. So what in situation if I forbid to user to add node? ItemAdded event does not have Cancel property. So? Another event?

Thx.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Prevent from adding node to diagram
Reply #1 - May 21st, 2009 at 5:09am
Print Post  
Hi,

If you validation function returns false:

- do not call diagram.Items.Add
- set e.DragAction = Cancel from the DiagramView.DragOver handler
- return null form the custom behavior StartDraw method

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



Posts: 90
Joined: Nov 29th, 2008
Re: Prevent from adding node to diagram
Reply #2 - May 21st, 2009 at 6:44am
Print Post  
Hi.

Hm, but I perform checking in ItemAdded event. Is there something like ItemAdding where I can cancel operation?

How can I do checking in my custom behavior class? There is not possible to create event and handle it on form...or?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Prevent from adding node to diagram
Reply #3 - May 21st, 2009 at 11:11am
Print Post  
Hi,

There is the NodeCreating event you could use to call your function instead in StartDraw, and call e.CancelDrag() if you want to stop the operation. It won't be raised in the other two cases.

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