How to ask for confirmation before a deletion

  XML_API > CAD XML API Reference > How To >

How to ask for confirmation before a deletion

Previous pageReturn to chapter overviewNext page

There are two ways of “confirming the deletion”

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

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

2.  Event="OnConfirmEntitiesDeletion"

Event allows controlling from your application if you wish to delete 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>

On this event our demo (not CADEDitorX itself!) shows message like this:

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

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

So, you can make such a dialog in your application and delete the entities after the user presses “OK” in YOUR confirmation dialog.

 

Go to ABViewer