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

Delete node with confirmation

Hi,

Is there any possibility to display confirmation box when user attempts to delete the node from the diagram (by pressing the key "Delete"). I'm trying to accomplish it in the following way:
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Remove)
{
DialogResult dialogResult = MessageBox.Show(""...);

}
}

The main issue is when I'm trying to delete multiple items then the message box is displayed for each node which is being deleted. E.g. if I'm trying to delete 100 nodes this messagebox will be displayed 1000 times.

From other hands the following approach does not work too:

private void diagram1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
{
DialogResult dialogResult = MessageBox.Show(...);
}
}

Because the event is raised after the node was deleted (that is, after the events NodeCollectionChanging and NodeCollectionChanged)

Could you please help me to find possible solution?

Best regards,
Borys


2 Replies

AM Ajeet M Syncfusion Team February 2, 2009 09:09 AM UTC

Hi bgener,

As per the official policy, we will not be able to post the details about feature or defect fix and custom build information in public forums. We have noticed that you have an account in Direct Trac and you can use it to create a new incident, to which we could provide you the more appropriate details.

Let me know if you shall need any further clarifications in this regard.

Regards,
Ajeet




ER Eric Robishaw February 10, 2009 11:22 PM UTC

At the start of NodeCollectionChanging ask the user if they want to delete the node and add an "Do the same for all nodes" option check box.
Then, you apply the same logic to each changing event.


>Hi,

Is there any possibility to display confirmation box when user attempts to delete the node from the diagram (by pressing the key "Delete"). I'm trying to accomplish it in the following way:
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{
if (evtArgs.ChangeType == CollectionExChangeType.Remove)
{
DialogResult dialogResult = MessageBox.Show(""...);

}
}

The main issue is when I'm trying to delete multiple items then the message box is displayed for each node which is being deleted. E.g. if I'm trying to delete 100 nodes this messagebox will be displayed 1000 times.

From other hands the following approach does not work too:

private void diagram1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
{
DialogResult dialogResult = MessageBox.Show(...);
}
}

Because the event is raised after the node was deleted (that is, after the events NodeCollectionChanging and NodeCollectionChanged)

Could you please help me to find possible solution?

Best regards,
Borys




Loader.
Live Chat Icon For mobile
Up arrow icon