How to ask for confirmation before a deletion

<< Click to Display Table of Contents >>

Navigation:  How To >

How to ask for confirmation before a deletion

There are two ways of “confirming the deletion”:

1. Library will ask before deleting entities, handles of which are specified in the <CustomSelectMode> parameters:

<?xml version="1.0" encoding="utf-8"?>
<cadsofttools version="2.0">
<CustomSelectMode AskOnDelete="True" Handle="$2C"/>
</cadsofttools>

 

2.  Event="OnConfirmEntitiesDeletion"

Event allows to control it from your application if you wish to delete an entity or not.

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
   <!-- Sign to OnConfirmEntitiesDeletion event. Result is handles list of deleted entities.
        The entities deletion works only by xml commands. -->
 <signtoevent Event="OnConfirmEntitiesDeletion"/>
</cadsofttools>

 

When the user wants to delete an entity, CADEditorX will not delete it, just the event will be called with the result like here:

<cadsofttools version="2.0">
 <ConfirmEntitiesDeletion>
   <result handle="$2C"/>
 </ConfirmEntitiesDeletion>
</cadsofttools>

 

In this event, our demo (not CADEditorX itself) shows message like this:

clip0005-1

 

And after clicking “Yes” it runs xml to delete the selected entities:

<?xml version="1.0" encoding="UTF-8"?>
<cadsofttools version="2">
 <delete/>
</cadsofttools>

 

So, you can activate such a dialog in your application and delete entities after pressing OK in your confirmation dialog.

Go to CADEditorX